Skip to content

Instantly share code, notes, and snippets.

@deepal
Last active September 25, 2019 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save deepal/cf61bc4972a77566d7637f800ed29a78 to your computer and use it in GitHub Desktop.
Save deepal/cf61bc4972a77566d7637f800ed29a78 to your computer and use it in GitHub Desktop.
if (err instanceof AuthenticationError) {
return res.status(401).send('not authenticated');
}
if (err instanceof UnauthorizedError) {
return res.status(403).send('forbidden');
}
if (err instanceof InvalidInputError) {
return res.status(400).send('bad request');
}
if (err instanceof DuplicateKeyError) {
return res.status(409).send('conflict. entity already exists');
}
// Generic error
return res.status(500).send('internal error occurred')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment