Re: Try/Catch
- Posted by jimcbrown (admin) Mar 25, 2015
- 3633 views
But what's the difference between a recoverable and unrecoverable?
You can trap the former and continuie program execution without making the sytem unstable or introducing logic errors (at least in principle), but you can't do this for the latter.
Well, duh, but my point was that it's not always obvious when an error is one or the other.
Oops. That's a good point.... that's probably a significant factor in causing try/catch overuse/abuse.
I've thought about it and decided to revise my definition.
An unrecoverable is an error that makes the system so unstable that there's simply no hope of recovery. (E.g. stack corruption, OOM, etc.) Anything not this severe is a recoverable (though perhaps at the risk of introducing logic errors - but one can introduce logic errors that can't be caught out by a Throwable anyways).