diff --git a/index.js b/index.js index 333a02e..04abb43 100644 --- a/index.js +++ b/index.js @@ -84,14 +84,10 @@ exports = module.exports = function errorHandler (options) { } return function errorHandler (err, req, res, next) { - // respect err.statusCode - if (err.statusCode) { - res.statusCode = err.statusCode - } - - // respect err.status if (err.status) { res.statusCode = err.status + } else if (err.statusCode) { + res.statusCode = err.statusCode } // default status code to 500