-
-
Notifications
You must be signed in to change notification settings - Fork 375
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
Add ResultFailureException
and T.fail
convenience API
#3422
base: main
Are you sure you want to change the base?
Conversation
Removed `Exception` from `Result.Failing` hierarchy. It was added after the last release, so this should be considered a binary compatible change. The `T.fail` shortcut is an experiment. Pease comment WDYT. This change was discussed in #3406
It needs to be removed later, when we can break bin-compat.
fa8f3db
to
1a7ce13
Compare
The test covering this task: def sometimesFailingWithException(fail: Boolean): Task[String] = T.task {
if (!fail) "Success"
else T.fail("Failure")
} fails with
So, I wonder why? The |
Instead of converting to a |
The idea is, to keep the control flow of tasks returning results functional. I still have this idea in my mind, that we one day can recover from failed tasks (#1779), but that's only possible if we stick to a uniform way of failing. |
I think this approach looks fine by me |
This PR is still in draft state, since there is one open issue: #3422 (comment). Has an fix or an idea? |
The
T.fail
shortcut is an experiment. Pease comment WDYT.This change was discussed in #3406
I'd also like to remove the
Exception
fromResult.Failing
hierarchy,but it was added before the last stable release, so this would be
considered a binary incompatible change.