Skip to content

Commit

Permalink
pretty-print error responses
Browse files Browse the repository at this point in the history
  • Loading branch information
andrasq committed Mar 31, 2021
1 parent e9a47e0 commit e3b44ec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mw.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ function writeResponse( res, statusCode, body, headers ) {
// TODO: also look up message in http.STATUS_CODES[err.code || statusCode]
body = { error: '' + (err.code || statusCode), message: '' + (err.message || 'Internal Error'), debug: '' + (err.debug || '') };
if (err.details) body.details = '' + (err.details);
body = JSON.stringify(body);
body = JSON.stringify(body, null, 2);
headers = undefined;
}
else if (typeof body === 'string' || (body && body.constructor === String) || Buffer.isBuffer(body)) body = body;
Expand Down

0 comments on commit e3b44ec

Please sign in to comment.