Skip to content

Commit 17b1974

Browse files
committed
fix: error response handler handles now the proper error, instead of moving to nuxt error handling.
1 parent ba06cdf commit 17b1974

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/server_middleware/api.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,12 @@ function injectAPI(options) {
117117

118118
// Error Response handler
119119
router.use(function (err, req, res, next) {
120-
return Promise.resolve(options.errorHandler(err, req))
121-
.then(_err => options.errorResponse(_err || err, req, res, options))
122-
.catch(_err => options.errorResponse(_err, req, res, options))
120+
try {
121+
Promise.resolve(options.errorHandler(err, req))
122+
.then(_err => options.errorResponse(_err || err, req, res, options));
123+
} catch (_err) {
124+
options.errorResponse(_err, req, res, options);
125+
}
123126
});
124127

125128
return {

0 commit comments

Comments
 (0)