u
This commit is contained in:
@@ -23,6 +23,10 @@ function captureResponseBody(res) {
|
||||
res.json = (payload) => {
|
||||
let out = payload;
|
||||
if (res.statusCode >= 500 && payload && typeof payload === 'object' && 'error' in payload) {
|
||||
if (!res.locals?.error && typeof payload.error === 'string') {
|
||||
res.locals = res.locals || {};
|
||||
res.locals.error = new Error(payload.error);
|
||||
}
|
||||
out = { ...payload, error: 'Internal server error' };
|
||||
}
|
||||
body = out;
|
||||
|
||||
Reference in New Issue
Block a user