The art of throwing JavaScript errors

There were two good reminder pieces for me in this article:

Errors are the friends of developers, not enemies.

And

It helps to think of errors as built-in failure cases. It’s always easier to plan for a failure at a particular point in code than it is to anticipate failure everywhere.