Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need a more robust way of handling exceptions from Firebase #35

Open
grodin opened this issue Oct 2, 2021 · 2 comments
Open

Need a more robust way of handling exceptions from Firebase #35

grodin opened this issue Oct 2, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request robustness Issues related to making the app more robust
Milestone

Comments

@grodin
Copy link
Collaborator

grodin commented Oct 2, 2021

Firebase throws exceptions for many things, often as way of signalling something non-exceptional. We need a more robust strategy for handling these exceptions, particularly as different Firebase components use exceptions in different ways.

For example, FirebaseAuthException has a number of different subclasses for different exceptional events, whereas FIrebaseFirestoreException is a single class with an enum field to tell you what kind of exception it is.

A first sketch for the auth "module" (not actually a separate module yet) might be something like

typealias FirebaseAuthServiceExceptionHandler = (FirebaseAuthException) -> FirebaseAuthServiceError

sealed interface FirebaseAuthServiceError

typealias FirebaseAuthServiceErrorHandler = (FirebaseAuthServiceError) -> WorkflowAction<AuthProps, AuthState, AuthOutput>

The first typealias would be used in FirebaseAuthService and the second in ActualAuthWorkflow.

It's likely that we also need a strategy for sending notifications back up the workflow tree. For example, if an exception is thrown because the user has become unauthenticated, we need that to go all the way back up to the root workflow so the user can log back in.

An enhancement to this could be to include the state of each workflow on the way up the tree so that once the user logs in again they can be returned to wherever they were rather than manually navigating back.

@grodin grodin added enhancement New feature or request robustness Issues related to making the app more robust labels Oct 2, 2021
@grodin grodin self-assigned this Oct 11, 2021
@grodin grodin added this to the 0.1 milestone Oct 16, 2021
@grodin
Copy link
Collaborator Author

grodin commented Mar 16, 2022

Related: #70

@grodin
Copy link
Collaborator Author

grodin commented Mar 25, 2022

The first step to this is to stop using runSuspendCatching() and instead use an explicit try { } catch { } block. It's probably worth at least building something small to at least always rethrow CancellationException for coroutines.

@grodin grodin closed this as completed Jul 31, 2023
@grodin grodin reopened this Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request robustness Issues related to making the app more robust
Projects
None yet
Development

No branches or pull requests

1 participant