From d64577bfe2fce4100bb6ec07ad174f5d535ab467 Mon Sep 17 00:00:00 2001 From: Flavio Alescio Date: Thu, 11 May 2023 14:34:18 +0200 Subject: [PATCH] fix throwing task compile error --- .../SessionVerificationScreenViewModel.swift | 6 +++++- .../TimelineController/MockRoomTimelineController.swift | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ElementX/Sources/Screens/SessionVerificationScreen/SessionVerificationScreenViewModel.swift b/ElementX/Sources/Screens/SessionVerificationScreen/SessionVerificationScreenViewModel.swift index d804d5161c..6e12abd945 100644 --- a/ElementX/Sources/Screens/SessionVerificationScreen/SessionVerificationScreenViewModel.swift +++ b/ElementX/Sources/Screens/SessionVerificationScreen/SessionVerificationScreenViewModel.swift @@ -109,7 +109,11 @@ class SessionVerificationScreenViewModel: SessionVerificationViewModelType, Sess case (_, _, .verified): // Dismiss the success screen automatically. Task { - try await Task.sleep(for: .seconds(2)) + do { + try await Task.sleep(for: .seconds(2)) + } catch { + MXLog.error(error.localizedDescription) + } self.callback?(.finished) } default: diff --git a/ElementX/Sources/Services/Timeline/TimelineController/MockRoomTimelineController.swift b/ElementX/Sources/Services/Timeline/TimelineController/MockRoomTimelineController.swift index 46eae5a687..6b5a52ecb9 100644 --- a/ElementX/Sources/Services/Timeline/TimelineController/MockRoomTimelineController.swift +++ b/ElementX/Sources/Services/Timeline/TimelineController/MockRoomTimelineController.swift @@ -81,7 +81,13 @@ class MockRoomTimelineController: RoomTimelineControllerProtocol { let client = try UITestsSignalling.Client(mode: .app) signalCancellable = client.signals.sink { [weak self] signal in - Task { try await self?.handleSignal(signal) } + Task { + do { + try await self?.handleSignal(signal) + } catch { + MXLog.error(error.localizedDescription) + } + } } self.client = client