hackersatbrown / api-morning-mail

2 stars 0 forks source link

Abstract over error response creation #9

Closed jonahkagan closed 11 years ago

jonahkagan commented 11 years ago

Instead of constructing literal objects like { error: "message" }, have a function mk_error(message) that constructs an error object. That way we can easily extend it to have more info, codes, etc.

jonahkagan commented 11 years ago

Oh wait, actually, restify has a built in system for error handling. Let's use that.

http://mcavage.github.com/node-restify/#Error-handling