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

Install a global uncaught exception handler #1735

Merged
merged 2 commits into from
Dec 8, 2023

Conversation

swankjesse
Copy link
Collaborator

No description provided.

@@ -60,9 +61,14 @@ public class StandardAppLifecycle(
internal val coroutineScope = CoroutineScope(coroutineExceptionHandler)

override fun start(host: Host) {
check(!started) { "already started" }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idea to serve as an input: no-op / return directly if the app already started vs. throw an exception, it makes it potentially less painful when downstream is implemented with flickering state (like session manager 😅)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like to fail fast by default, and relax as necessary later. It reduces the number of different states this thing can be in.

In this case I don’t want to think about what happens if I get two different Host instances. That would suck.

Copy link

@jingwei99 jingwei99 Dec 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t want to think about what happens if I get two different Host instances. That would suck

that's really true! (so downstream is responsible to manage the/their life cycle correctly)

@swankjesse swankjesse requested a review from jingwei99 December 8, 2023 18:11
@swankjesse swankjesse merged commit 5815ba4 into trunk Dec 8, 2023
8 checks passed
@swankjesse swankjesse deleted the jwilson.1208.global_uncaught_exception_handler branch December 8, 2023 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants