Flow and Try, Catch and Finally
Table of Contents
For most developers the Try, Catch, Finally construction is a very common way of handling errors.
Within Power Automate flows this pattern is also possible.
Today I setup a flow with a manual start and 3 Scopes. I renamed the scopes to Try, Catch and Finally as shown below.
This is the basic flow for the try-catch-finally pattern.

Try
In the try section I put all the actions that form my main process. The main process may fail anywhere, however I am not going to worry about these failures for now.
Handling exceptions for each action would become quite difficult and it would clutter my flow in Power Automate.
In this pattern I’m assuming that if any error does occur in the Try block of steps that we want to stop the flow and start the error handling part of the process.
Catch
Then for the Catch part of the try, catch and finally pattern I set the run after to has failed

In the catch section I add all the failure handling code. This error handling could for example include sending an email with the URL of the flow run to the user that started the flow or maybe even log a support ticket.
The Url of the flow run could be constructed with the following code:
concat('https://unitedkingdom.flow.microsoft.com/manage/environments/',
workflow()?['tags']['environmentName'],
'/flows/', workflow()?['name'],
'/runs/',
workflow()?['run']['name'])
I described this in my Expression 1 of the post 7 one line expressions
The possibilities are endless.
You could even consider restarting your flow in Power Automate if the flow fails because of an overload of you connector
Finally
For the finally scope I ticked all the boxes in the the run after configuration

The only limitation to this solutions that I have found so far it that you can’t collect any exceptions that may be generated. Hopefully soon Microsoft Flow will give the option to collect exceptions.
The closest I’ve got so far with action level exception handling is described in my post Get the result of your failed actions in Power Automate. In this post I managed to get some error details using the result function. However if you planned to collect the error details of every action possible then you might end up with very large flows. I would not recommend that approach for larger flows.
For additional information, for example on how to collect the flow run url and send it to the users or administrators see also, Microsoft Flow – You only need one template to get started. This post also gets you to the Flow template available in your tenant that you could use the implement the basic pattern.
More Power Automate Try Catch Finally post
Implementing a Try, Catch, Finally in Logic Apps
Retrying after failures in Microsoft Flow
[…] Microsoft Flow – Implementing a Try, Catch , Finally in a flow by Pieter Veenstra […]
[…] while back I write about a Try – Catch construction in Microsoft Flow. Within my Catch I then sent email with some limited information […]
[…] When I start developing a new flow there are a few things that I put in place first. For me Microsoft Flow development all starts with making the process robust. Therefore I start with the try-catch pattern as I described in Microsoft Flow – Implementing a Try, Catch , Finally in a flow. […]
Thank you, Peter! I was wondering about the best way to do try catch. I really like your approach because Scope clearly show what is inside Try, Catch and Finally. Without scopes – it was a total mess.
[…] robust you will know that the analytics are very helpful. Even though you might have implemented error handling in you flow, your failing actions and triggers are still reported here. Very often it is possible […]
It’s to bad the try scope will trigger the “Flow run failed.” message instead of showing success due to the catch scope.
I find that it actually helps having the scope show “Flow run failed”, it means that it is quite easy to step into your flow so that you can find the failing action.
I agree with you there. To clarify, my issue is when a “failure” is an acceptable completion of the flow there should be a way to not say it failed.
I like that idea!
I’ve created an idea on the Flow Community site for this:
https://powerusers.microsoft.com/t5/Flow-Ideas/Unfail-parent-steps-in-Microsoft-Flow/idi-p/190953#M10943
Please update it.
[…] the past I wrote quite a few posts about error handling in Microsoft Flow. In general, error handling means that you need to deal with something that has gone wrong. […]
This is excellent stuff ! Thank you very much Pieter
[…] regular followers will be aware of the Try-Catch pattern in Power Automate that I cannot stop talking about. The try catch, will already send the URL to the flow run, but now […]
you spelled Microsoft wrong (second sentence) but thank you for the post.
Thank you. Fix that
Perhaps a way to see the exceptions is to log or email the workflow instance link?
Do you mean like using the irst expression mentioned in this post: https://sharepains.com/2019/05/06/one-liner-expressions-power-automate/