Add errorHandler tests

This commit is contained in:
Nick O'Leary
2015-02-20 19:54:19 +00:00
parent 5599b999ec
commit c80a44933c
3 changed files with 139 additions and 9 deletions

View File

@@ -208,18 +208,19 @@ function diffNodeConfigs(oldNode,newNode) {
function createCatchNodeMap(nodes) {
var catchNodes = {};
var subflowInstances = {};
var id;
/*
- a catchNode with same z as error node
- if error occurs on a subflow without catchNode, look at z of subflow instance
*/
for (var id in nodes) {
for (id in nodes) {
if (nodes.hasOwnProperty(id)) {
if (nodes[id].type === "catch") {
catchNodes[nodes[id].z] = nodes[id];
}
}
}
for (var id in nodes) {
for (id in nodes) {
if (nodes.hasOwnProperty(id)) {
var m = /^subflow:(.+)$/.exec(nodes[id].type);
if (m) {
@@ -227,7 +228,7 @@ function createCatchNodeMap(nodes) {
}
}
}
for (var id in subflowInstances) {
for (id in subflowInstances) {
if (subflowInstances.hasOwnProperty(id)) {
var z = id;
while(subflowInstances[z]) {
@@ -744,8 +745,8 @@ Flow.prototype.handleError = function(node,logMessage,msg) {
errorMessage.error = {
message: logMessage.toString(),
source: {
id: this.id,
type: this.type
id: node.id,
type: node.type
}
};
if (this.catchNodeMap[node.z]) {