handleError(node,logMessage,msg,reportingNode) {
        if (!reportingNode) {
            reportingNode = node;
        }
        // console.log("HE",logMessage);
        var count = 1;
        if (msg && msg.hasOwnProperty("error") && msg.error) {
            if (msg.error.hasOwnProperty("source") && msg.error.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 false;
                    }
                }
            }
        }
        let handled = false;

        if (this.id === 'global' && node.users) {
            // This is a global config node
            // Delegate status to any nodes using this config node
            for (let userNode in node.users) {
                if (node.users.hasOwnProperty(userNode)) {
                    handled = node.users[userNode]._flow.handleError(node,logMessage,msg,node.users[userNode]) || handled;
                }
            }
        } else {
            const candidateNodes = [];
            this.catchNodes.forEach(targetCatchNode => {
                if (targetCatchNode.g && targetCatchNode.scope === 'group' && !reportingNode.g) {
                    // Catch node inside a group, reporting node not in a group - skip it
                    return
                }
                if (Array.isArray(targetCatchNode.scope) && targetCatchNode.scope.indexOf(reportingNode.id) === -1) {
                    // Catch node has a scope set and it doesn't include the reporting node
                    return;
                }
                let distance = 0
                if (reportingNode.g) {
                    // Reporting node inside a group. Calculate the distance between it and the catch node
                    let containingGroup = this.groups[reportingNode.g]
                    while (containingGroup && containingGroup.id !== targetCatchNode.g) {
                        distance++
                        containingGroup = this.groups[containingGroup.g]
                    }
                    if (!containingGroup && targetCatchNode.g && targetCatchNode.scope === 'group') {
                        // This catch node is in a group, but not in the same hierachy
                        // the reporting node is in
                        return
                    }
                }
                candidateNodes.push({ d: distance, n: targetCatchNode })
            })
            candidateNodes.sort((A,B) => {
                return A.d - B.d
            })
            let handledByUncaught = false
            candidateNodes.forEach(candidate => {
                const targetCatchNode = candidate.n
                if (targetCatchNode.uncaught && !handledByUncaught) {
                    // This node only wants errors that haven't already been handled
                    if (handled) {
                        return
                    }
                    handledByUncaught = true
                }
                let 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,
                        name: node.name,
                        count: count
                    }
                };
                if (logMessage.hasOwnProperty('code')) {
                    errorMessage.error.code = logMessage.code;
                }
                if (logMessage.hasOwnProperty('stack')) {
                    errorMessage.error.stack = logMessage.stack;
                }
                if (logMessage.hasOwnProperty('cause')) {
                    errorMessage.error.cause = logMessage.cause;
                }
                targetCatchNode.receive(errorMessage);
                handled = true;
            });
        }
        return handled;
    }
Handle an error event from a node within this flow. If there are no Catch
nodes within this flow, pass the event to the parent flow.
@param  {[type]} node          [description]
@param  {[type]} logMessage    [description]
@param  {[type]} msg           [description]
@param  {[type]} reportingNode [description]
@return {[type]}               [description]