-
Notifications
You must be signed in to change notification settings - Fork 506
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
Allow overriding how fatal errors are printed #3993
Comments
I think there are only a couple areas (at the edge of the world, basically) where we forcibly print the stack trace. In most cases, we rely on |
Usual failure reporter (i.e., I also wouldn't rely on (or require) an IOApp instance to be available and in scope. Wouldn't it be better to do it the other way round? i.e., rely on an |
I was thinking of
What thread though? One of the problems here is the fact that this callback will be invoked on a different thread than you might be expecting, and likely one which is under the control of the |
I've seen quite a few cases where an |
The I think that all that really needs to be changed here is the hard-coded |
Please have a look at this proposal, it is minimal in that:
There are also a few usages of |
Also, the proposed fix would need to be slightly adapted if #4010 is accepted |
The handling of some uncaught fatal errors can be customized by overriding
cats.effect.IOApp.reportFailure
.However, such customization is currently not possible in many cases (all usages of
java.lang.Throwable.printStackTrace()
, for example here).Would it be possible to handle similar situations like in the fs2 reactive-streams integration here i.e., by using (if defined) java thread's default
UncaughtExceptionHandler
?This would allow one to redirect uncaught errors to a custom logger, so that it gets properly ingested in a logging stack/system.
The text was updated successfully, but these errors were encountered: