| ▲ | yoyohello13 2 hours ago | ||||||||||||||||||||||||||||||||||||||||
Probably not, since errors as values are way better than exceptions. | |||||||||||||||||||||||||||||||||||||||||
| ▲ | nomel 2 hours ago | parent [-] | ||||||||||||||||||||||||||||||||||||||||
How so? An exception is a value that's given the closest, conceptually appropriate, point that was decided to handle the value, allowing you to keep your "happy path" as clean code, and your "exceptional circumstances" path at the level of abstraction that makes sense. It's way less book-keeping with exceptions, since you, intentionally, don't have to write code for that exceptional behavior, except where it makes sense to. The return by value method, necessarily, implements the same behavior, where handling is bubbled up to the conceptually appropriate place, through returns, but with much more typing involved. Care is required for either, since not properly bubbling up an exception can happen in either case (no re-raise for exceptions, no return after handling for return). | |||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||