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 {
6262 -> DocumentReference {
6363 return try await withCheckedThrowingContinuation { continuation in
6464 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+ }
7173 }
74+ } catch {
75+ continuation. resume ( throwing: error)
7276 }
7377 }
7478 }
You can’t perform that action at this time.
0 commit comments