DEV Community

Discussion on: Throwing exceptions vs Returning failure object

Collapse
 
iquardt profile image
Iven Marquardt • Edited

Since you tagged your post with #functional: I think you've made the right conclusion by favoring a return value over an effect (of throwing) but for the wrong reason. The functional paradigm paves the way for math in programming. Functions don't have effects in math. As soon as you treat effects as values and defer their execution, you greatly simplify your code, because now you can reason locally and equationally about it.