Error Handling

Types of Errors

There are two categories of errors you'll need to take into account when building a solution.

  • Node errors occur when a Node fails to execute. Examples include a Node that has been misconfigured or where it requires a Connection and the password that is stored in the Connection is outdated.

  • Data errors occur when a Node executes successfully but the response indicates that there is at least partial failure. For example, you might use the Salesforce Node to push 10 contact records into Salesforce. The response that is returned shows that 9 succeeded and 1 failed.

Handling Node Errors

You can handle Node errors by attaching to one of the error outputs.

Node Error Outputs

Attaching a Flow Connector to the Error Execution output of the Node will handle the error.

Use this technique whenever you are aware of errors that may need to be handled as the result of execution of a certain Node.

UnhandledError & AnyError Outputs

The Start Node includes special Workflow-wide error outputs - UnhandledError and AnyError.

Attaching a Flow Connector to the UnhandledError output will handle errors that occur on any Node that does not have its Error Flow Socket connected. It therefore acts as a global error handler.

UnhandledError will not fire for any errors that are handled directly on the Node.

By contrast, the AnyError Output will always fire when an error occurs on a Node even the Error output of the Node is connected to another Node. For this reason AnyError is normally only used to record errors (e.g. to a log) rather than taking a corrective action.

Handling Data Errors

First, determine how the Node reports success or failure. For example, here is a document showing a success response and another showing a failure response for the same transaction:

{
	order: {
		"order": "123",
		"purchaseOrderNumber":"abc"
	}
}
{
	order: {
		"purchaseOrderNumber":"abc"
		"error":"Not enough stock to create this order."
	}
}

Add an If Node after the Connector Node that attempted to create a transaction. Use a Flow Connector to push the result from the Connector into the Expression Property of the If Node, then use a Data Flow Connector Expression to locate either order.order if you are testing for success or order.error if you are testing for failure.

After the If Node, add any handling you need to record or remediate the error.

Also consider using Key/Value Nodes to record the outcome of the integration so that you can generate reports on it later.

The scenario above will work if you are processing one record at a time. If your Connector Node is processing multiple records, use QuickMap to obtain a key and value for the success and failure information then use the bulk Key/Values Node Set Key-Values 2 to record all outcomes in one step.

If you then need to take action on failures only or success only, use For Each to iterate through each record to take individual actions.

Global Error Handlers

It's often useful to have a catch-all error handler that will record and notify of errors occurring across all Workflows.

Create an error handler Workflow that you can call as a Sub-Workflow and then call that Sub-Workflow from the UnhandledError Output of the Start Node.

The error handling Sub-Workflow could be used to record errors to a database, send an email or send a message to a specific channel of your comms platform.