Enable express error handler (#4697)
* Propagate error to express handler in all situations * Call the default error handler if `enableExpressErrorHandler` is truthy * Updating options interface and definitions * Testing express error handler * Test spec fixes * Fix test
This commit is contained in:
committed by
Florent Vilmart
parent
ced6b76ef5
commit
b22947d4ec
@@ -284,6 +284,9 @@ export function handleParseErrors(err, req, res, next) {
|
||||
res.status(httpStatus);
|
||||
res.json({ code: err.code, error: err.message });
|
||||
log.error(err.message, err);
|
||||
if (req.config && req.config.enableExpressErrorHandler) {
|
||||
next(err);
|
||||
}
|
||||
} else if (err.status && err.message) {
|
||||
res.status(err.status);
|
||||
res.json({ error: err.message });
|
||||
|
||||
Reference in New Issue
Block a user