Last active
September 25, 2019 15:20
-
-
Save deepal/cf61bc4972a77566d7637f800ed29a78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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