File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Source/Public/FirebaseFirestore Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -143,7 +143,8 @@ NS_SWIFT_NAME(Firestore)
143
143
* block will run even if the client is offline, unless the process is killed.
144
144
*/
145
145
- (void )runTransactionWithBlock:(id _Nullable (^)(FIRTransaction *, NSError **))updateBlock
146
- completion:(void (^)(id _Nullable result, NSError *_Nullable error))completion;
146
+ completion:(void (^)(id _Nullable result, NSError *_Nullable error))completion
147
+ __attribute__((swift_async_error(nonnull_error)));
147
148
148
149
/* *
149
150
* Creates a write batch, used for performing multiple writes as a single
Original file line number Diff line number Diff line change @@ -43,6 +43,16 @@ let emptyBundle = """
43
43
XCTAssertTrue ( snapshot. exists)
44
44
}
45
45
46
+ func testRunTransactionDoesNotCrashOnNilSuccess( ) async throws {
47
+ let document = collectionRef ( ) . document ( )
48
+ let value = try await db. runTransaction ( { transact, error in
49
+ transact. setData ( [ " test " : " test " ] , forDocument: document)
50
+ return nil // should not crash
51
+ } )
52
+
53
+ XCTAssertNil ( value, " value should be nil on success " )
54
+ }
55
+
46
56
func testLoadBundleFromData( ) async throws {
47
57
let bundle = " \( emptyBundle. count) \( emptyBundle) "
48
58
let bundleProgress = try await db. loadBundle ( Data ( bundle. utf8) )
You can’t perform that action at this time.
0 commit comments