Skip to content
This repository has been archived by the owner on May 28, 2018. It is now read-only.

Commit

Permalink
Wrap Unauthorized errors in a generic message
Browse files Browse the repository at this point in the history
  • Loading branch information
nbrohee committed Nov 8, 2016
1 parent 812addc commit 82150cb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/api/lib/middlewares/formatError.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ module.exports = function (err, req, res, next) {
return res.status(err.code).json(error)
}
}
if (err.name === 'UnauthorizedError') {
return res.status(401).send('The provided token is invalid');
}
next(err)
}

0 comments on commit 82150cb

Please sign in to comment.