fix(invites): bogus validation errors

This commit is contained in:
Sabe Jones
2018-11-07 15:58:17 -06:00
parent 1ac4dd8171
commit b1dd79f75c
5 changed files with 9 additions and 164 deletions

View File

@@ -16,7 +16,7 @@ module.exports = function errorHandler (err, req, res, next) { // eslint-disable
// Otherwise try to identify the type of error (mongoose validation, mongodb unique, ...)
// If we can't identify it, respond with a generic 500 error
let responseErr = err instanceof CustomError ? err : null;
console.log(err)
// Handle errors created with 'http-errors' or similar that have a status/statusCode property
if (err.statusCode && typeof err.statusCode === 'number') {
responseErr = new CustomError();