@@ -88,22 +88,30 @@ func waitFixtureChannelIsReady(_: ARTRealtime) async throws {
8888 try await Task . sleep ( nanoseconds: 5 * NSEC_PER_SEC)
8989}
9090
91- func waitForMapKeyUpdate( _ map: any LiveMap , _ key: String ) async {
92- await withCheckedContinuation { ( continuation: CheckedContinuation < Void , _ > ) in
93- map. subscribe { update, subscription in
94- if update. update [ key] != nil {
95- subscription. unsubscribe ( )
96- continuation. resume ( )
91+ func waitForMapKeyUpdate( _ map: any LiveMap , _ key: String ) async throws {
92+ try await withCheckedThrowingContinuation { ( continuation: CheckedContinuation < Void , _ > ) in
93+ do {
94+ try map. subscribe { update, subscription in
95+ if update. update [ key] != nil {
96+ subscription. unsubscribe ( )
97+ continuation. resume ( )
98+ }
9799 }
100+ } catch {
101+ continuation. resume ( throwing: error)
98102 }
99103 }
100104}
101105
102- func waitForCounterUpdate( _ counter: any LiveCounter ) async {
103- await withCheckedContinuation { ( continuation: CheckedContinuation < Void , _ > ) in
104- counter. subscribe { _, subscription in
105- subscription. unsubscribe ( )
106- continuation. resume ( )
106+ func waitForCounterUpdate( _ counter: any LiveCounter ) async throws {
107+ try await withCheckedThrowingContinuation { ( continuation: CheckedContinuation < Void , _ > ) in
108+ do {
109+ try counter. subscribe { _, subscription in
110+ subscription. unsubscribe ( )
111+ continuation. resume ( )
112+ }
113+ } catch {
114+ continuation. resume ( throwing: error)
107115 }
108116 }
109117}
@@ -310,10 +318,10 @@ private struct ObjectsIntegrationTests {
310318 // Create the promise first, before the operations that will trigger it
311319 async let objectsCreatedPromise : Void = withThrowingTaskGroup ( of: Void . self) { group in
312320 group. addTask {
313- await waitForMapKeyUpdate ( root, " counter " )
321+ try await waitForMapKeyUpdate ( root, " counter " )
314322 }
315323 group. addTask {
316- await waitForMapKeyUpdate ( root, " map " )
324+ try await waitForMapKeyUpdate ( root, " map " )
317325 }
318326 while try await group. next ( ) != nil { }
319327 }
@@ -331,13 +339,13 @@ private struct ObjectsIntegrationTests {
331339 // Create the promise first, before the operations that will trigger it
332340 async let operationsAppliedPromise : Void = withThrowingTaskGroup ( of: Void . self) { group in
333341 group. addTask {
334- await waitForMapKeyUpdate ( map, " anotherKey " )
342+ try await waitForMapKeyUpdate ( map, " anotherKey " )
335343 }
336344 group. addTask {
337- await waitForMapKeyUpdate ( map, " shouldDelete " )
345+ try await waitForMapKeyUpdate ( map, " shouldDelete " )
338346 }
339347 group. addTask {
340- await waitForCounterUpdate ( counter)
348+ try await waitForCounterUpdate ( counter)
341349 }
342350 while try await group. next ( ) != nil { }
343351 }
@@ -382,10 +390,10 @@ private struct ObjectsIntegrationTests {
382390 // Create the promise first, before the operations that will trigger it
383391 async let objectsCreatedPromise : Void = withThrowingTaskGroup ( of: Void . self) { group in
384392 group. addTask {
385- await waitForMapKeyUpdate ( root, " counter " )
393+ try await waitForMapKeyUpdate ( root, " counter " )
386394 }
387395 group. addTask {
388- await waitForMapKeyUpdate ( root, " map " )
396+ try await waitForMapKeyUpdate ( root, " map " )
389397 }
390398 while try await group. next ( ) != nil { }
391399 }
@@ -582,7 +590,7 @@ private struct ObjectsIntegrationTests {
582590 key: " counter " ,
583591 createOp: objectsHelper. counterCreateRestOp ( number: 1 ) ,
584592 )
585- _ = await counterCreatedPromise
593+ _ = try await counterCreatedPromise
586594
587595 #expect( try root. get ( key: " counter " ) != nil , " Check counter exists on root before OBJECT_SYNC sequence with \" tombstone=true \" " )
588596
@@ -636,7 +644,7 @@ private struct ObjectsIntegrationTests {
636644 key: " counter " ,
637645 createOp: objectsHelper. counterCreateRestOp ( number: 1 ) ,
638646 )
639- _ = await counterCreatedPromise
647+ _ = try await counterCreatedPromise
640648
641649 async let counterSubPromise : Void = withCheckedThrowingContinuation { continuation in
642650 do {
0 commit comments