Error handling

kkaefer edited this page May 16, 2011 · 1 revision

Server side

When a request to the server fails, you should call next() with an Error object. Setting the status on that object will send that status code back. The error reply depends on the Accept header, and will either be plain text or JSON.

To simplify error handling, Bones provides Error.HTTP which accepts a HTTP status code after the message or as first argument instead of a message.