-
Notifications
You must be signed in to change notification settings - Fork 449
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
Make a common public parent for raise exception #3349
Conversation
Kover Report
|
What type of code is this PR intended to allow? merely distinguishing Raise errors from other cancellations, or is it something more? I ask because |
Yes, the only goal was merely distinguishing Raise errors from other cancellations as we've discussed in your CCE PR.
I didn't want to prematurely add it, since there are safer and better ways to access those values. Such as It'll be easy to expose it later on, but hard/impossible to remove. |
I like this change because it finally allows the usage intended by the |
arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/Fold.kt
Show resolved
Hide resolved
Yes, to both your comments @kyay10! Will update the PR momentarily 👍 |
@kyay10 I added your suggestions. The message of the exception always includes: internal const val RaiseCancellationExceptionCaptured: String =
"kotlin.coroutines.cancellation.CancellationException should never get swallowed. Always re-throw it if captured." +
"This swallows the exception of Arrow's Raise, and leads to unexpected behavior." +
"When working with Arrow prefer Either.catch or arrow.core.raise.catch to automatically rethrow CancellationException." |
arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/Fold.kt
Outdated
Show resolved
Hide resolved
…ise/Fold.kt Co-authored-by: Youssef Shoaib <[email protected]>
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.
Nice!
arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/Fold.kt
Outdated
Show resolved
Hide resolved
arrow-libs/core/arrow-core/src/jvmMain/kotlin/arrow/core/raise/CancellationExceptionNoTrace.kt
Show resolved
Hide resolved
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.
LGTM!
No description provided.