Hello. I want to both start `either { … }` block a...
# arrow
f
Hello. I want to both start
either { … }
block and catch any exceptions inside like:
Copy code
either {
    Either.catch {
        // potentially throwing code
    }.bind()
}
Is there a builtin function for such case? something like
Copy code
eitherCatch { … }
s
Such a function is not available yet, and you need context receivers to define it 😕 We're working on such functions though, but since working with
Either
is typically over
E
the function is currently prototyped as:
Copy code
either<Error, A> {
  val a: A = catch(
   { // throwing code },
   { e: Throwable ->
     // shift(e.toError())
     // transform(e).bind()
     // return fallback A
   })
   a
}