Try and handling (specific) typed exceptions #1209
Unanswered
NickDarvey
asked this question in
Q&A
Replies: 1 comment 4 replies
-
There’s two natural-transformation extension methods called ToEither: One maps to Either<Exception, A>, the other allows you to map the Excepton |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm wrapping a library which throws on expected errors.
Is there a way to avoid the explicit types in
.Map(Either<AccessFailure, AuthenticationResult>.Right)
?(If I just use
Right
method from prelude then it returns anEitherRight
to which myLeft
is not convertible.)Otherwise, I'm sure this is a common pattern (going from Trys to Eithers), so is there a better way to approach it altogether? (I had a look in the tests but didn't examples which match on specific exception types.)
Beta Was this translation helpful? Give feedback.
All reactions