Add some more error handlers for custom node label functions

Closes #956
This commit is contained in:
Nick O'Leary 2016-08-11 14:49:22 +01:00
parent 42f4e0fa86
commit e6b5552cba
2 changed files with 13 additions and 2 deletions

View File

@ -138,7 +138,12 @@ RED.deploy = (function() {
}
var label = "";
if (typeof node._def.label == "function") {
label = node._def.label.call(node);
try {
label = node._def.label.call(node);
} catch(err) {
console.log("Definition error: "+node_def.type+".label",err);
label = node_def.type;
}
} else {
label = node._def.label;
}

View File

@ -133,7 +133,13 @@ RED.sidebar.config = (function() {
nodes.forEach(function(node) {
var label = "";
if (typeof node._def.label == "function") {
label = node._def.label.call(node);
try {
label = node._def.label.call(node);
} catch(err) {
console.log("Definition error: "+node_def.type+".label",err);
label = node_def.type;
}
} else {
label = node._def.label;
}