Ones where you want to log the error and stop what you're doing
Ones where you want to do something with the error - continue execution with default data, warn the user, retry or undo the effects of an action, etc
There are more try/catch blocks than necessary. For all errors of type 1, a try/catch block at the outermost level of the first function called is sufficient. The error will bubble up.
This leaves space to think more intentionally about handling the other errors that may arise.
Errors can be divided into two types:
There are more try/catch blocks than necessary. For all errors of type 1, a try/catch block at the outermost level of the first function called is sufficient. The error will bubble up.
This leaves space to think more intentionally about handling the other errors that may arise.