I was helping someone today with their javascript and they asked me about how and when I manage errors in the classes and functions that I write. I wrote him back an email which I think actually could be useful to others, so here it is.
There are three types of error handling that I use:
- Graceful: if possible, just ignore the error and continue with some default state or without a meaningful value
- Debug: throw a warning to the dbug.log method but continue otherwise
- Break: Either explicitly throw an error or (more often) just let the error that is thrown at runtime be thrown

