Flow Patterns: Error Processing
Goal
Gracefully process failing actions in your flows without failing the whole flow.
Solution
Use the “Configure run after” setting to define error processing action.
Let’s consider a sample flow:
When running the flow, a user should enter a name for a library. The flow requests the last 10 created documents from the library and sends an email with a list of documents. If a user will enter a name for a library that does not exist, the flow will fail. The user will not get any message about that.
Error messages especially important with scheduled and automatically triggered flows.
To process errors, you need to define “Configure run after” setting. Let’s add a new parallel action that will send an email about errors:
After that, select “Configure run after” in the action’s menu:
In the “Configure run after” dialog select “has failed” and “has timed out” options:
You will end with a flow that looks like the following:
Note that the right “Send email with an error message” action has got a red dashed line to it. It is to highlight that it has got “configure run after” configured.
Final result
Now, if a user will define an existing name for a library, the flow will run as expected: get last 10 documents from a library and send them in an email:
If a user will specify a library that does not exist, the flow will fail and a user will get an email about the problem:
Applying error processing to multiple actions
If you want to apply an error processing action to multiple actions, you need to move these actions under a “Scope” action: