Specify alternate actions to handle an error without stopping your Flow.
The function gives you something that looks more like a container than a card, allowing you to specify:
Try - one or more Actions and/or Functions you want to run.
If Error - the alternate Actions and Functions to execute if there's an error in any of the Try steps.
Outputs(optional) - output fields that can be used in subsequent steps of the Flow. The value assigned to each output depends on whether or not there was an error.
When you create a new If Error, the first step is to define your Try steps. These are one or more Actions and/or Functions to run. Add cards to this container just as you would elsewhere in a Flow.
To add error handling to an existing set of steps in your Flow, insert the If Error block to the right of the cards you want in your Try block and then drag them in, one by one, starting with the rightmost card.
To retry a step in your Flow automatically before manually fixing an error, see Set error handling for cards in Flows.
Use the dropdown at the top left to switch between the Try steps and If Error steps.
The If Error block contains the steps you want to take to handle the error. Insert Actions and/or Functions just as you would elsewhere in a Flow.
Given to you at the beginning of each If Error block is an Error object. This object contains the details of the error in the Try block that results in a switch to the If Error block, including: message - the text of the error message (when available), code - the error code (e.g. 500), method - the ID for the step where the error occurred, Flow - the ID of the Flow, and execution - the ID of the particular execution of the Flow. You can use these values in your error handling steps, for instance, if you want to send an email with details of the error, or conditionally check whether or not to proceed based on whether it's an expected error.
Note: Return and Continue If will typically end a Flow but behave differently when inside a Try or If Error block. Think of Try or If Error blocks as anonymous child Flows -- and just as when you call a child Flow, a Return returns you to the parent. So, a Return or Continue-If (when false) inside a Try or If Error block proceeds to the step immediately after the If Error container. Use Return Error or Return Error If, or a Continue-If outside the If Error, you want to halt the Flow rather than continue.
Output Fields (Optional)
You can drag outputs from cards that run before the If Error into a Try or If Error block, but you cannot drag outputs from inside the Try or If Error block to cards that are run after the If Error. This is because a step from inside a Try or If Error may not always run. The way to get around this is to use the optional Outputs feature.
You access the Outputs by clicking View Outputs, which can be found on the top-right of the If Error container. This opens up a pane that appears to the right of the Try and If Error blocks. Click to add a new output -- you can type the name and choose the type. Beneath each output you get two inputs: one for the case that there is no error (drop an output here from the Try block) and the other for the case there is an error (drop an output here from the If Error block).
The Outputs in this pane can be mapped to subsequent steps in the Flow.