File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Firestore/Swift/Source/Codable Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -62,13 +62,17 @@ public extension CollectionReference {
62
62
-> DocumentReference {
63
63
return try await withCheckedThrowingContinuation { continuation in
64
64
var document : DocumentReference ?
65
- document = self . addDocument ( from: value, encoder: encoder) { error in
66
- if let error {
67
- continuation. resume ( throwing: error)
68
- } else {
69
- // Our callbacks guarantee that we either return an error or a document.
70
- continuation. resume ( returning: document!)
65
+ do {
66
+ document = try self . addDocument ( from: value, encoder: encoder) { error in
67
+ if let error {
68
+ continuation. resume ( throwing: error)
69
+ } else {
70
+ // Our callbacks guarantee that we either return an error or a document.
71
+ continuation. resume ( returning: document!)
72
+ }
71
73
}
74
+ } catch {
75
+ continuation. resume ( throwing: error)
72
76
}
73
77
}
74
78
}
You can’t perform that action at this time.
0 commit comments