Skip to content

Commit 351b449

Browse files
authored
json_error_handler: cfg.includeErrStack
Support flag for development and integration environments: includeErrStack ``` openapi-error: name: json_error_handler handle500Errors: true includeErrStack: true ``` Change is backward compatible (missing config is understood as the default - false) I still need to add tests
1 parent 833c3b1 commit 351b449

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fittings/json_error_handler.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ module.exports = function create(fittingDef, bagpipes) {
3535

3636
context.headers['Content-Type'] = 'application/json';
3737
Object.defineProperty(err, 'message', { enumerable: true }); // include message property in response
38+
if (fittingDef.includeErrStack)
39+
Object.defineProperty(err, 'stack', { enumerable: true }); // include stack property in response
3840

3941
delete(context.error);
4042
next(null, JSON.stringify(err));

0 commit comments

Comments
 (0)