Be more lenient with fatalErrors coming out of equal transitions, caused by asynchronicity on the UI layer

This commit is contained in:
Stefan Ceriu
2023-09-01 13:35:27 +03:00
committed by Stefan Ceriu
parent d90d7adb21
commit 61326ed63a
3 changed files with 15 additions and 3 deletions
@@ -277,9 +277,13 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationCoordinatorDelegate,
} }
stateMachine.addErrorHandler { context in stateMachine.addErrorHandler { context in
if context.fromState == context.toState {
MXLog.error("Failed transition from equal states: \(context.fromState)")
} else {
fatalError("Failed transition with context: \(context)") fatalError("Failed transition with context: \(context)")
} }
} }
}
private func restoreUserSession() { private func restoreUserSession() {
Task { Task {
@@ -254,9 +254,13 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
} }
stateMachine.addErrorHandler { context in stateMachine.addErrorHandler { context in
if context.fromState == context.toState {
MXLog.error("Failed transition from equal states: \(context.fromState)")
} else {
fatalError("Failed transition with context: \(context)") fatalError("Failed transition with context: \(context)")
} }
} }
}
/// Updates the navigation stack so it displays the timeline for the given room /// Updates the navigation stack so it displays the timeline for the given room
/// - Parameters: /// - Parameters:
@@ -209,9 +209,13 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
} }
stateMachine.addErrorHandler { context in stateMachine.addErrorHandler { context in
if context.fromState == context.toState {
MXLog.error("Failed transition from equal states: \(context.fromState)")
} else {
fatalError("Failed transition with context: \(context)") fatalError("Failed transition with context: \(context)")
} }
} }
}
private func presentMigrationScreen() { private func presentMigrationScreen() {
// Listen for the first sync to finish. // Listen for the first sync to finish.