From 2160c668e6313d4ea5a78a91de0ba96dec843435 Mon Sep 17 00:00:00 2001 From: Celadora Date: Thu, 26 Jan 2017 14:10:06 -0800 Subject: [PATCH 1/2] fixed bug in json_error_handler --- fittings/json_error_handler.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fittings/json_error_handler.js b/fittings/json_error_handler.js index b62563d..69655d0 100644 --- a/fittings/json_error_handler.js +++ b/fittings/json_error_handler.js @@ -29,7 +29,6 @@ module.exports = function create(fittingDef, bagpipes) { } try { - //TODO: find what's throwing here... if (context.statusCode === 500 && !fittingDef.handle500Errors) { return next(err); } //else - from here we commit to emitting error as JSON, no matter what. @@ -38,7 +37,8 @@ module.exports = function create(fittingDef, bagpipes) { if (fittingDef.includeErrStack) Object.defineProperty(err, 'stack', { enumerable: true }); // include stack property in response - delete(context.error); + context.error = new Error(null); + next(null, JSON.stringify(err)); } catch (err2) { log = context.request && ( From f6c128a5e07a634b807563a94153f005b495ca30 Mon Sep 17 00:00:00 2001 From: Celadora Date: Thu, 26 Jan 2017 14:48:54 -0800 Subject: [PATCH 2/2] commented out new Error(null) --- fittings/json_error_handler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fittings/json_error_handler.js b/fittings/json_error_handler.js index 69655d0..0e02682 100644 --- a/fittings/json_error_handler.js +++ b/fittings/json_error_handler.js @@ -37,7 +37,7 @@ module.exports = function create(fittingDef, bagpipes) { if (fittingDef.includeErrStack) Object.defineProperty(err, 'stack', { enumerable: true }); // include stack property in response - context.error = new Error(null); + //context.error = new Error(null); next(null, JSON.stringify(err)); } catch (err2) {