Assert
Controlled node
Overview
Route execution when a value passes or reports an error.
Assert checks a value and chooses pass or error. Use it after a node that returns an error object as data, rather than stopping the workflow itself.
Assert routes execution; it is not a breakpoint and does not catch exceptions thrown by an earlier node.
Inputs
| Input | Type | Description |
|---|---|---|
| run | Event | Checks the supplied value. |
| value | Data | The result or condition to check. |
Properties
| Property | Type | Description | Default |
|---|---|---|---|
| failOnlyOnError | Boolean | Fail only for an explicit error object when enabled. | false |
Fail Only On Error is off by default.
- Off: explicit error objects and values treated as false take the error path.
- On: only explicit error objects take the error path. Values such as
0,false,""andnullmay pass.
An explicit error object has an error field with a value treated as true, such as {"error":"Request failed"}. Merely having that field is not sufficient: {"error":false}, {"error":null} and {"error":""} pass.
With the option off, false, 0, an empty string, null and missing values fail. Text equal to "false", "null" or "undefined" also fails, ignoring case and surrounding spaces.
Lists and objects without an active error field pass, including empty lists and objects. This is not a schema validator or a check that a list contains rows.
Outputs
| Output | Type | Description |
|---|---|---|
| pass | Event | Continues when the check passes. |
| error | Event | Runs your error-handling branch when the check fails. |
There is no data output socket. Connect the original value directly to any later node that needs it. In the editor, the panel shows the failure message, or a passing status.
Example
- Connect Query Batch Data's data to value.
- Connect its done event to run.
- Enable Fail Only On Error to distinguish a query failure from a worker with no rows.
- Connect error to a logging or failure-handling action.
- On pass, separately check for
nullbefore iterating over the returned rows.
To deliberately fail the run after validation, connect error to Throw.