throwing is discouraged, so when/fold is the way to go if you want to do it 😄
t
Tom Davis
09/19/2023, 2:01 PM
gotcha. i don't want to, but that's the controller api 😉
a
Alejandro Serrano.Mena
09/19/2023, 3:01 PM
in those cases you can do
theEitherValue.getOrElse { throw it }
, which I find quite readable and not so verbose
âž• 6
c
CLOVIS
09/20/2023, 7:53 AM
@Alejandro Serrano.Mena any preference between
either.getOrElse { throw it }
and
either.recover { throw it }
?
To my knowledge, these behave the same?
a
Alejandro Serrano.Mena
09/20/2023, 8:01 AM
I tend to use the first one, mostly out of taste (and it also feels a bit weird to say that "throwing" is recovering from an exception 😅)
also lately I'm trying to use