1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Capture error stack on node.error

Closes #879
This commit is contained in:
Nick O'Leary 2016-06-12 11:07:05 +01:00
parent 4dc9c7714c
commit 945fbbc065
2 changed files with 8 additions and 1 deletions

View File

@ -72,7 +72,11 @@ var consoleLogger = function(msg) {
if (msg.level == log.METRIC || msg.level == log.AUDIT) { if (msg.level == log.METRIC || msg.level == log.AUDIT) {
util.log("["+levelNames[msg.level]+"] "+JSON.stringify(msg)); util.log("["+levelNames[msg.level]+"] "+JSON.stringify(msg));
} else { } else {
util.log("["+levelNames[msg.level]+"] "+(msg.type?"["+msg.type+":"+(msg.name||msg.id)+"] ":"")+msg.msg); var message = msg.msg;
if (typeof message === 'object' && message.toString() === '[object Object]' && message.message) {
message = message.message;
}
util.log("["+levelNames[msg.level]+"] "+(msg.type?"["+msg.type+":"+(msg.name||msg.id)+"] ":"")+message);
} }
} }

View File

@ -247,6 +247,9 @@ function Flow(global,flow) {
count: count count: count
} }
}; };
if (logMessage.hasOwnProperty('stack')) {
errorMessage.error.stack = logMessage.stack;
}
targetCatchNode.receive(errorMessage); targetCatchNode.receive(errorMessage);
handled = true; handled = true;
}); });