Structured error handling in a Node.js API

Errors are part of your API's contract. Design them rather than letting them happen.