I heard from some people that in Scala we tend (like other functional languages) to not break the control flow... Instead by convention we return the error in an Either Left.
But how do we get the stracktrace from that exception?
For now i return in the Left a simple Error case class with a code, message and cause (Error too). But if i have an error, i can't get the stacktrace.
If my application become complexe it may be hard to find the code block that returned that Error... The root cause is essential.
So what do we do in practice?
Should i return, instead of a custom Error, the java type Exception or Throwable in my Left?
What's the best practice for Scala exception handling without loosing important informations such as the stacktrace and the cause?