3 ms·
But then the failed code which decides if the error is recoverable, not the part of the code doing the recovering.
by goto11 7y ago
But then the failed code which decides if the error is recoverable, not the part of the code doing the recovering.
- rectang 7y agoYes! We shouldn't expect downstream to wrap every array access which could be out of bounds in a "try" block. We shouldn't expect downstream to wrap every division operation in order to catch potential divide by zero errors. Those should be fatal errors, catchable only at a very coarse-grained level, because once they occur the program state is potentially compromised in a way which the programmer did not plan for. The library author gets to decide whether a potential failure mode should expose a recovery API.