-
Notifications
You must be signed in to change notification settings - Fork 536
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
[WIP] Create UnsafeNonFatal for use in the fiber runtime #4263
base: series/3.6.x
Are you sure you want to change the base?
Conversation
Thanks for the PR!! Sorry, would you mind re-targeting to the |
569d1c9
to
ee6f0b8
Compare
Done. |
3970f74
to
58a9c5d
Compare
* code, as handling interrupts gracefully is the responsibility of the runtime, so | ||
* [[UnsafeNonFatal]] should only be used in the fiber runtime. | ||
*/ | ||
object UnsafeNonFatal { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be public?
/** | ||
* Returns Some(t) if RuntimeNonFatal(t) == true, otherwise None | ||
*/ | ||
def unapply(t: Throwable): Option[Throwable] = Some(t).filter(apply) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If t
is considered fatal, I think we shouldn't allocate a new object (it could be, e.g., an OutOfMemoryError
).
Creates a custom
NonFatal
type for use in the fiber runtime. This is needed because while application code generally shouldn't catchInterruptedException
, the fiber runtime is responsible for dealing with interrupts gracefully.Initially I considered naming this
RuntimeNonFatal
, however I thinkUnsafeNonFatal
makes it really clear that you shouldn't use it without knowing what you are doing.Will resolve #4254