Workflow Error Trigger Node
The Workflow Error Trigger will execute whenever a halting error occurs anywhere within the scope configured. You can then perform any necessary actions that are required to handle that error. The trigger places useful information on the payload, including the ID and type of the node that caused the error and the original payload at the time the error occurred.
Our workflow engine has two types of errors: halting errors and non-halting errors:
- Halting errors immediately stop the workflow and prevent it from continuing. Non-halting errors place an error message on a node’s result and the workflow will continue executing.
- Non-halting errors can easily be checked and handled by your workflow. After a node executes that can potentially result in an error, we recommend adding a Conditional Node to make sure the node’s operation was successful. Halting errors, however, can be easily handled with the Workflow Error Trigger.
Node Properties
The Workflow Error Trigger will fire whenever another node causes an error that halts the flow. These errors are displayed in the Debug menu with a red message like so:
Scope
By default, the scope of a Workflow Error Trigger is local to the workflow in which the trigger is located. For edge versions prior to 1.20.0 this is the only option.
For application, experience, and edge versions starting with 1.20.0, there are additional scopes available.
Application
In Application Workflows, there are four scopes available. You may elect to have the Workflow Error Trigger fire …
- Only when a node within the same workflow errors
- When any application workflow errors
- When any experience workflow errors
- When any application or experience workflow errors
An application workflow with a Workflow Error Trigger will always fire the default version of the workflow regardless of the version of the flow that threw the error.
Experience
In Experience Workflows, there are two scopes available. You may elect to have the Workflow Error Trigger fire …
- Only when a node within the same workflow errors
- When any experience workflow within the same experience version errors
Edge
In Edge Workflows starting with 1.20.0, there are two scopes available. You may elect to have the Workflow Error Trigger fire …
- Only when a node within the same workflow errors
- When any edge workflow deployed to the same device errors
Payload
The payload created by the trigger will include:
- Information about the error
- The node that triggered the error
- The payload at the time of the error
In the general case, a Workflow Error payload will look like the following:
{
"globals": <object of workflow globals>,
"applicationName": <name of the current application>,
"flowName": <name of the current workflow>,
"flowId": <id of the current workflow>,
"flowVersion": <version of the triggered workflow>,
"triggerType": "flowError",
"triggerId": <id of the workflow trigger>,
"applicationId": <id of the current application>,
"data": {
"errorInfo" : {
"nodeId": <id of the node that caused the error>,
"nodeType": <type of the node that caused the error>,
"error": <the type and message of the error that was thrown>
},
"erroredPayload": <copy of the payload at the time of error>
},
"time": <time of the error>,
}
For the example workflow above, a specific payload for a triggered workflow might look like this:
{
"globals": {},
"applicationName": "Retention",
"flowName": "Big Data",
"flowId": "5d56e856005f990006c855bf",
"flowVersion": "develop",
"relayType": "flow",
"relayId": "5d56e856005f990006c855bf",
"triggerType": "flowError",
"triggerId": "5d56e856005f990006c855bf-flowError",
"applicationId": "5c365aee856a620008b8f0cd",
"data": {
"errorInfo": {
"error": {
"message": "Invalid topic name: ",
"name": "ValidationError"
},
"nodeId": "s3p0lvab77",
"nodeType": "MqttMessageNode"
},
"erroredPayload": {
"globals": {},
"applicationName": "Retention",
"flowName": "Big Data",
"flowId": "5d56e856005f990006c855bf",
"relayType": "user",
"relayId": "5a67c0e0b5548300060f6a0f",
"flowVersion": "develop",
"triggerType": "virtualButton",
"triggerId": "5d56e856005f990006c855bf-nXAHZHl1gz",
"applicationId": "5c365aee856a620008b8f0cd",
"data": { "topic": "" },
"time": "2019-11-04T14:48:03.524Z"
}
},
"time": "2019-11-04T14:48:03.543Z"
}
Considerations
- The Workflow Error Trigger will not fire from workflows that were kicked off by a Workflow Error Trigger.