Closed AdamVig closed 8 years ago
Restify comes with all of the HTTP status codes as error messages. See Restify Error Handling for more details. This could be a good way to throw errors in the app.
Restify error handling is excellent. Main improvements:
restify.UnauthorizedError()
) instead of HTTP error codes (401
), which makes for more readable code.The format of the error response is now JSON, like the following:
{
"code": "BadGatewayError",
"explanation": "Something went wrong! 🆘",
"message": "Could not find chapel credits in HTML."
}
Instead of returning only a friendly error message as
text/plain
, return a JSON object containing the following fields:This change should also come with more descriptive use of error codes.