full-path / ridesheet

Google apps script support for a Google Sheets-based demand-responsive trip scheduling and reporting system.
MIT License
5 stars 4 forks source link

Streamline error handling #11

Open NomeQ opened 3 years ago

NomeQ commented 3 years ago

Errors can be divided into two types:

  1. Ones where you want to log the error and stop what you're doing
  2. 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.