Overview
The error mapper is an optional TypeScript function you can add to any action node or while loop node. It runs when a node fails, letting you inspect and reshape the raw error before the platform's retry strategies and error links evaluate it. In this article, we'll be covering what the error output mapper does, where to find it, and how to write one.
Understand how the error mapper works
When a node fails, the engine normally passes the raw error directly to any configured retry strategies and error links. With an error mapper, you intercept that error first. The function receives the raw error object and returns a reshaped version — the rest of the error-handling chain then evaluates that reshaped error instead of the original.
This is especially useful when integrations return error detail buried inside nested payloads (for example, SOAP fault codes inside an HTTP 500 response). Rather than building a separate sub-workflow to extract that data, you can handle it inline on the node.
The evaluation order is:
- Error mapper
- Retry strategies
- Error links
- Workflow failure
The error mapper is available on all action nodes and while loop nodes. It is not available on condition nodes, parallel loop nodes, or the trigger.
Write an error mapper
The function receives the following parameters:
error.code— the error code stringerror.message— the human-readable error messageerror.payload— any additional payload from the failing integration (may be undefined)
The function must return an object with the following shape:
- code — string (required)
- message — string (required)
- payload — any (optional)
The returned value replaces the original error. Both code and message are required in the return object. If the mapper itself throws an error, the original error is used instead.
Add an error mapper to a node
- Open the workflow in the builder.
- Click the node you want to configure.
- Open the Configure tab in the side panel.
- Scroll to the Error mapper section, below Output mapper.
- Click Add error mapper.
- Write your TypeScript function.
- Save the workflow.
Remove an error mapper
- Open the node's Configure tab.
- In the Error mapper section, click the delete icon in the top-right corner.
- Save the workflow.
Related to