Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.