mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Ensure status/error events are propagated to parent properly
This commit is contained in:
@@ -191,6 +191,50 @@ class Subflow extends Flow {
|
||||
}
|
||||
super.start(diff);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a status event from a node within this flow.
|
||||
* @param {Node} node The original node that triggered the event
|
||||
* @param {Object} statusMessage The status object
|
||||
* @param {Node} reportingNode The node emitting the status event.
|
||||
* This could be a subflow instance node when the status
|
||||
* is being delegated up.
|
||||
* @param {boolean} muteStatus Whether to emit the status event
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
handleStatus(node,statusMessage,reportingNode,muteStatus) {
|
||||
let handled = super.handleStatus(node,statusMessage,reportingNode,muteStatus);
|
||||
if (!handled) {
|
||||
// No status node on this subflow caught the status message.
|
||||
// Pass up to the parent with this subflow's instance as the
|
||||
// reporting node
|
||||
handled = this.parent.handleStatus(node,statusMessage,this.node,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]
|
||||
*/
|
||||
handleError(node,logMessage,msg,reportingNode) {
|
||||
let handled = super.handleError(node,logMessage,msg,reportingNode);
|
||||
if (!handled) {
|
||||
// No catch node on this subflow caught the error message.
|
||||
// Pass up to the parent with the subflow's instance as the
|
||||
// reporting node.
|
||||
handled = this.parent.handleError(node,logMessage,msg,this.node);
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user