Skip to content

Instantly share code, notes, and snippets.

@orels1
Created May 16, 2017 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orels1/d9e11dd23c67a091ef331b319ec2a116 to your computer and use it in GitHub Desktop.
Save orels1/d9e11dd23c67a091ef331b319ec2a116 to your computer and use it in GitHub Desktop.
app.use((err, req, res, next) => {
switch (err.message) {
case 'NoCodeProvided':
return res.status(400).send({
status: 'ERROR',
error: err.message,
});
default:
return res.status(500).send({
status: 'ERROR',
error: err.message,
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment