|
|
|
|
|
by desbo
1948 days ago
|
|
You don't necessarily lose the stack trace. Typically the left side of an either is an Exception (or an error ADT that wraps one). When you want to handle the left case, you can log out the full trace as you would without Either. The Monad instance for Either means that chaining them together with flatMap has a short-circuiting effect and the first failure will stop the rest of the chain from being evaluated. I find this actually makes it easier to know where your errors are happening, and also allows you to centralise your error handling logic. |
|
If you go onto the scaladoc for Either today, you see a stringly-typed Either where they discard the Exception.