Try to Catch This
by in Representative Line on 2024-10-07The power of exception handling is that it allows every layer in our stack be notified of an error condition, do something about it, and pass it on if necessary.
For example, if you have a data access layer and a query fails, you may catch the exception and potentially retry there, only passing the exception up the stack after a few failures. Or, you may fail to connect, updates some internal status variables to represent that you're in an invalid state, and then pass that exception up the stack.