Power Automate: Error Handling | Scope Controls [try/catch/finally]


Reiterating, “high-code” error handling isn’t supported in Power Automate. However, flow creators can use Scope controls and mimic a try-catch-finally execution:

Figure 1 - Power Automate list of controls.
Figure 1Power Automate list of controls.

To recreate the “try-catch-finally”-esque experience, add three Scope blocks to the flow and rename each:

  • Try,
  • Catch,
  • Finally.

Next, add the necessary actions to each Scope, then Configure run after for the “Catch” and “Finally” blocks:

Figure 2 - Power Automate try-catch-finally Scope controls.
Figure 2Power Automate try-catch-finally Scope controls.

Fundamentally, the “Try” scope will contain the action(s) likely to cause an error, so configure the “Catch” scope to run if it has failed. The “Finally” block should run whether the “Catch” is successful or is skipped:

Figure 3 - Power Automate Configure run after "Try" scope.
Figure 3Power Automate Configure run after “Try” scope.
Figure 4 - Power Automate Configure run after "Catch" scope.
Figure 4Power Automate Configure run after “Catch” scope.

And as expected, when there is an error, the “Catch” actions are executed. Otherwise, the “Catch” actions are skipped. Lastly, the “Finally” actions are executed regardless of an error occurs or not:

Figure 5 - Power Automate run with successful error "Catch".
Figure 5Power Automate run with successful error “Catch”.
Figure 6 - Power Automate run with successful skip of "Catch".
Figure 6Power Automate run with successful skip of “Catch”.

Conclusion:
Power Automate is “low-code”, so traditional developers often need to get creative. With a bit of resourcefulness, flow makers can mimic some “high-code” concepts.

“In recognizing the humanity of our fellow beings, we pay ourselves the highest tribute.”

Thurgood Marshall

#BlackLivesMatter

Leave a comment