Handle null debug messages

Fixes #200
This commit is contained in:
Nick O'Leary 2014-04-16 11:37:18 +01:00
parent 9ad4d50442
commit a386c028b0
2 changed files with 9 additions and 6 deletions

View File

@ -62,8 +62,7 @@ RED.nodes.registerType("debug",DebugNode);
DebugNode.send = function(msg) { DebugNode.send = function(msg) {
if (msg.msg instanceof Error) { if (msg.msg instanceof Error) {
msg.msg = msg.msg.toString(); msg.msg = msg.msg.toString();
} } else if (typeof msg.msg === 'object') {
else if (typeof msg.msg === 'object') {
var seen = []; var seen = [];
var ty = "(Object) "; var ty = "(Object) ";
if (util.isArray(msg.msg)) { ty = "(Array) "; } if (util.isArray(msg.msg)) { ty = "(Array) "; }
@ -75,9 +74,13 @@ DebugNode.send = function(msg) {
return value; return value;
}," "); }," ");
seen = null; seen = null;
} else if (typeof msg.msg === "boolean") {
msg.msg = "(boolean) "+msg.msg.toString();
} else if (msg.msg === 0) {
msg.msg = "0";
} else if (msg.msg == null) {
msg.msg = "[undefined]";
} }
else if (typeof msg.msg === "boolean") msg.msg = "(boolean) "+msg.msg.toString();
else if (msg.msg === 0) msg.msg = "0";
if (msg.msg.length > debuglength) { if (msg.msg.length > debuglength) {
msg.msg = msg.msg.substr(0,debuglength) +" ...."; msg.msg = msg.msg.substr(0,debuglength) +" ....";

View File

@ -58,12 +58,12 @@ function FunctionNode(n) {
this.send(results); this.send(results);
} catch(err) { } catch(err) {
this.error(err.message); this.error(err);
} }
} }
}); });
} catch(err) { } catch(err) {
this.error(err.message); this.error(err);
} }
} }