3 ms·
IO errors, division by zero and other truly exceptional situations are well suited for exceptions. Validation cases like the examples on the article are not ex
by exDM69 10y ago
IO errors, division by zero and other truly exceptional situations are well suited for exceptions.
Validation cases like the examples on the article are not exceptional and the failure cases must be handled properly. In this case it makes sense to use an Either -like solution where the compiler will warn if there are unhandled cases.
Both styles of error handling are useful in some cases and both have their issues.