https://kotlinlang.org logo
#arrow
Title
# arrow
d

Davio

06/06/2023, 10:06 AM
What is the canonical way to deal with an either where you want to throw a wrapped version of the exception (which in my case means Spring's exception handler will convert it to a response) or use the actual return value. I found fold with ifLeft and ifRight, but also getOrElse
t

than_

06/06/2023, 10:08 AM
Copy code
getOrElse{ throw it }
That's gonna allow you to use the right type, without needing to unpack/cast it further.
h

Hugo

06/07/2023, 1:04 AM
2 Views