3 ms·
In non-pure code, we would want to force the programmer to handle the exception. In this case, wherever `throw_exception` is called, the programmer would have
by winter_blue 4y ago
In non-pure code, we would want to force the programmer to handle the exception.
In this case, wherever `throw_exception` is called, the programmer would have to handle the exception, and either refactor the return value to indicate an error, change the return value to an Optional (and silently fail by returning an empty Optional), or cause/trigger a side effect (like terminating the thread/program termination early, with an exit code).