diff --git a/editor/js/ui/editor.js b/editor/js/ui/editor.js
index 8d4800de6..edbe0d3c5 100644
--- a/editor/js/ui/editor.js
+++ b/editor/js/ui/editor.js
@@ -637,16 +637,20 @@ RED.editor = (function() {
}
$("#dialog-form").find('[data-i18n]').each(function() {
var current = $(this).attr("data-i18n");
- if (current.indexOf(":") === -1) {
- var prefix = "";
- if (current.indexOf("[")===0) {
- var parts = current.split("]");
- prefix = parts[0]+"]";
- current = parts[1];
+ var keys = current.split(";");
+ for (var i=0;i').appendTo("#dialog-form");
prepareEditDialog(node,node._def,"node-input");
diff --git a/nodes/core/core/25-catch.html b/nodes/core/core/25-catch.html
index 8f3572727..9b60c5e90 100644
--- a/nodes/core/core/25-catch.html
+++ b/nodes/core/core/25-catch.html
@@ -15,6 +15,25 @@
-->
-
+
diff --git a/nodes/core/core/25-catch.js b/nodes/core/core/25-catch.js
index 54f028a4a..544db6e7f 100644
--- a/nodes/core/core/25-catch.js
+++ b/nodes/core/core/25-catch.js
@@ -20,6 +20,7 @@ module.exports = function(RED) {
function CatchNode(n) {
RED.nodes.createNode(this,n);
var node = this;
+ this.scope = n.scope;
this.on("input",function(msg) {
this.send(msg);
});
diff --git a/nodes/core/locales/en-US/messages.json b/nodes/core/locales/en-US/messages.json
index bc860bf6a..680b25606 100644
--- a/nodes/core/locales/en-US/messages.json
+++ b/nodes/core/locales/en-US/messages.json
@@ -68,7 +68,20 @@
}
},
"catch": {
- "catch": "catch"
+ "catch": "catch all",
+ "catchNodes": "catch (__number__)",
+ "label": {
+ "source": "Catch errors from",
+ "node": "node",
+ "type": "type",
+ "selectAll": "select all",
+ "sortByLabel": "sort by label",
+ "sortByType": "sort by type"
+ },
+ "scope": {
+ "all": "all nodes",
+ "selected": "selected nodes"
+ }
},
"debug": {
"output": "Output",
diff --git a/red/nodes/Flow.js b/red/nodes/Flow.js
index 7d9a82ef2..8b0844340 100644
--- a/red/nodes/Flow.js
+++ b/red/nodes/Flow.js
@@ -57,7 +57,7 @@ function createSubflow(sf,sfn,subflows) {
var node;
var wires;
var i,j,k;
-
+
// Clone all of the subflow node definitions and give them new IDs
for (i=0;i 0) {
throw new Error(Log._("nodes.flow.missing-types"));
}
events.emit("nodes-starting");
-
+
var id;
var node;
-
+
for (id in this.configNodes) {
if (this.configNodes.hasOwnProperty(id)) {
node = this.configNodes[id];
@@ -383,7 +385,7 @@ Flow.prototype.start = function(configDiff) {
}
}
}
-
+
for (id in this.nodes) {
if (this.nodes.hasOwnProperty(id)) {
node = this.nodes[id];
@@ -408,16 +410,16 @@ Flow.prototype.start = function(configDiff) {
}
}
}
-
+
this.catchNodeMap = createCatchNodeMap(this.activeNodes);
-
+
credentials.clean(this.config);
events.emit("nodes-started");
}
Flow.prototype.stop = function(configDiff) {
var nodeList;
-
+
if (configDiff) {
nodeList = configDiff.stop;
} else {
@@ -450,7 +452,7 @@ Flow.prototype.stop = function(configDiff) {
});
}
-Flow.prototype.getMissingTypes = function() {
+Flow.prototype.getMissingTypes = function() {
return this.missingTypes;
}
@@ -466,7 +468,7 @@ Flow.prototype.typeRegistered = function(type) {
}
}
return false;
-
+
}
Flow.prototype.getNode = function(id) {
@@ -487,10 +489,10 @@ Flow.prototype.eachNode = function(callback) {
}
Flow.prototype.diffConfig = function(config,type) {
-
+
var activeNodesToStop = [];
var nodesToRewire = [];
-
+
if (type && type!="full") {
var diff = diffFlow(this,config);
//var diff = {
@@ -499,16 +501,16 @@ Flow.prototype.diffConfig = function(config,type) {
// linked:[]
// wiringChanged: []
//}
-
+
var nodesToStop = [];
nodesToRewire = diff.wiringChanged;
-
+
if (type == "nodes") {
nodesToStop = diff.deleted.concat(diff.changed);
} else if (type == "flows") {
nodesToStop = diff.deleted.concat(diff.changed).concat(diff.linked);
}
-
+
for (var i=0;i 0) {
var subflowId = changedSubflowStack.pop();
-
+
config.forEach(function(node) {
if (node.type == "subflow:"+subflowId) {
if (!changedNodes[node.id]) {
@@ -646,17 +648,17 @@ function diffFlow(flow,config) {
}
}
});
-
+
}
-
+
config.forEach(function(node) {
buildNodeLinks(newLinks,node,flowNodes);
});
-
+
var markLinkedNodes = function(linkChanged,otherChangedNodes,linkMap,allNodes) {
var stack = Object.keys(changedNodes).concat(Object.keys(otherChangedNodes));
var visited = {};
-
+
while(stack.length > 0) {
var id = stack.pop();
var linkedNodes = linkMap[id];
@@ -675,7 +677,7 @@ function diffFlow(flow,config) {
}
markLinkedNodes(linkChangedNodes,{},newLinks,flowNodes);
markLinkedNodes(linkChangedNodes,{},activeLinks,flow.allNodes);
-
+
var modifiedLinkNodes = {};
config.forEach(function(node) {
@@ -683,13 +685,13 @@ function diffFlow(flow,config) {
// only concerned about unchanged nodes whose wiring may have changed
var newNodeLinks = newLinks[node.id];
var oldNodeLinks = activeLinks[node.id];
-
+
var newLinkMap = {};
newNodeLinks.forEach(function(l) { newLinkMap[l] = (newLinkMap[l]||0)+1;});
-
+
var oldLinkMap = {};
oldNodeLinks.forEach(function(l) { oldLinkMap[l] = (oldLinkMap[l]||0)+1;});
-
+
newNodeLinks.forEach(function(link) {
if (newLinkMap[link] != oldLinkMap[link]) {
modifiedLinkNodes[node.id] = node;
@@ -714,11 +716,11 @@ function diffFlow(flow,config) {
});
markLinkedNodes(linkChangedNodes,modifiedLinkNodes,newLinks,flowNodes);
-
+
// config.forEach(function(n) {
// console.log((changedNodes[n.id]!=null)?"[C]":"[ ]",(linkChangedNodes[n.id]!=null)?"[L]":"[ ]","[ ]",n.id,n.type,n.name);
// });
- //
+ //
// Object.keys(deletedNodes).forEach(function(id) {
// var n = flow.allNodes[id];
// console.log("[ ] [ ] [D]",n.id,n.type);
@@ -729,7 +731,7 @@ function diffFlow(flow,config) {
linked: Object.keys(linkChangedNodes).filter(function(id) { return linkChangedNodes[id].type != "subflow" && (!linkChangedNodes[id].z || flowNodes[linkChangedNodes[id].z].type != "subflow")}),
wiringChanged: []
}
-
+
config.forEach(function(n) {
if (!flowNodes[n.z] || flowNodes[n.z].type != "subflow") {
var originalNode = flow.allNodes[n.id];
@@ -738,51 +740,57 @@ function diffFlow(flow,config) {
}
}
});
-
+
return diff;
}
Flow.prototype.handleError = function(node,logMessage,msg) {
- var targetCatchNode = null;
- if (this.catchNodeMap[node.z]) {
- targetCatchNode = this.catchNodeMap[node.z];
- } else if (this.activeNodes[node.z] && this.catchNodeMap[this.activeNodes[node.z].z]) {
- targetCatchNode = this.catchNodeMap[this.activeNodes[node.z].z];
- }
-
- if (targetCatchNode) {
- var count = 1;
- if (msg && msg.hasOwnProperty("error")) {
- if (msg.error.hasOwnProperty("source")) {
- if (msg.error.source.id === node.id) {
- count = msg.error.source.count+1;
- if (count === 10) {
- node.warn(Log._("nodes.flow.error-loop"));
- return;
- }
+ var count = 1;
+ if (msg && msg.hasOwnProperty("error")) {
+ if (msg.error.hasOwnProperty("source")) {
+ if (msg.error.source.id === node.id) {
+ count = msg.error.source.count+1;
+ if (count === 10) {
+ node.warn(Log._("nodes.flow.error-loop"));
+ return;
}
}
}
-
- var errorMessage;
- if (msg) {
- errorMessage = redUtil.cloneMessage(msg);
- } else {
- errorMessage = {};
- }
- if (errorMessage.hasOwnProperty("error")) {
- errorMessage._error = errorMessage.error;
- }
- errorMessage.error = {
- message: logMessage.toString(),
- source: {
- id: node.id,
- type: node.type,
- count: count
+ }
+
+ var targetCatchNodes = null;
+ if (this.catchNodeMap[node.z]) {
+ targetCatchNodes = this.catchNodeMap[node.z];
+ } else if (this.activeNodes[node.z] && this.catchNodeMap[this.activeNodes[node.z].z]) {
+ targetCatchNodes = this.catchNodeMap[this.activeNodes[node.z].z];
+ }
+
+ if (targetCatchNodes) {
+ targetCatchNodes.forEach(function(targetCatchNode) {
+ console.log(targetCatchNode.scope);
+ if (targetCatchNode.scope && targetCatchNode.scope.indexOf(node.id) === -1) {
+ return;
}
- };
- targetCatchNode.receive(errorMessage);
+ var errorMessage;
+ if (msg) {
+ errorMessage = redUtil.cloneMessage(msg);
+ } else {
+ errorMessage = {};
+ }
+ if (errorMessage.hasOwnProperty("error")) {
+ errorMessage._error = errorMessage.error;
+ }
+ errorMessage.error = {
+ message: logMessage.toString(),
+ source: {
+ id: node.id,
+ type: node.type,
+ count: count
+ }
+ };
+ targetCatchNode.receive(errorMessage);
+ })
}
}