fix(updateMyCurrentChallenge): Bad mongo id will return user error

Mark these errors to be reported to the user instead of logged as a
server fault
This commit is contained in:
Berkeley Martinez
2018-01-22 17:08:33 -08:00
parent b2e58ab212
commit ffbf3bc826
4 changed files with 43 additions and 30 deletions

View File

@ -18,6 +18,7 @@ export function wrapHandledError(err, {
return err;
}
// for use with express-validator error formatter
export const createValidatorErrorFormatter = (type, redirectTo, status) =>
({ msg }) => wrapHandledError(
new Error(msg),