-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Replace "handle" with "tryHandle" for uncaught exceptions #3554
base: develop
Are you sure you want to change the base?
Conversation
I find this to be a much clearer mental model. * A handler can decide if it can process this particular exception. * A handler can be in an invalid state, and it can now pass handling the uncaught exception to the system, without making additional noise. * Before this change, there are *two* types of exception handlers: - Those that are used as coroutine context elements. If a coroutine context element processes an exception successfully, the system is not notified about them. - Those that are used as services. These are just notified about exception, they are not considered to be consuming them. I guess this was done for the sake of Android's pre-handler. If we forget about backward compatibility, I'm certain this is the way to do it, but I don't see a good way to make this change while staying backward-compatible.
Btw, it looks like it can be made backwards compatible with JDK8 default interface methods. |
I tend to agree with this statement. Great job with figuring it out! I would refine the API a bit to avoid situations where ordering is important by prohibiting user-defined platform exception handlers using any trick from our book (e.g. by introducing The good news are, |
7695863
to
b12a404
Compare
2d5008a
to
4fda39a
Compare
This is a draft because it is a big binary-compatibility-breaking change. I was hoping to start a discussion about this so that we could evolve this to some form that's acceptable to merge.
I find this to be a much clearer mental model.
If we forget about backward compatibility, I'm certain this is the way to do it, but I don't see a good way to make this change while staying backward-compatible.