-
Notifications
You must be signed in to change notification settings - Fork 1.9k
uncaughtExceptionPreHandler does not exist #3215
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
Comments
The docs should be updated, as the implementation changed since then. In any case, you shouldn't have to do anything, the docs only describe what our library does on its own. Adding |
Thank you for the reply. However, I would expect that I can somehow install my
own global CoroutineExceptionHandler, where I can say "write to this log" or something like that.
Something like `RxJavaPlugins.setErrorHandler` in RxJava. Is there no option for that?
|
We do not have option for that and we do not intend to provide one. Reactive frameworks experience showed us that having a global mutable state for dispatchers, error handlers, various on* hooks and shutdown hook is the very common source of non-deterministic bugs as the behaviour depends only on who is invoked first/last and has its The suggested solution is to have your own CEH in application-specific top-level scope. |
Thank you. However, maybe you shouldn't write "...it is possible to redefine global exception handler for all coroutines" in the documentation then, but maybe write that this is indeed not possible/recomended :) . I would also like it if you could give an example in the documentation on how to define a CEH on top-level scope. I work on Android, and I'm not 100% how to do this considering using the provided |
I tried to implement a global coroutine exception handler. However, the
uncaughtExceptionPreHandler
from the wiki does not exist. I also added thekotlinx-coroutines-android
lib in version 1.6, but I still don't get this. Is the wiki outdated, as the readme also does not say anything aboutuncaughtExceptionPreHandler
norThread.uncaughtExceptionPreHandler
?The text was updated successfully, but these errors were encountered: