Try, Catch and Finally Flow
For most developers the Try, Catch, Finally construction is a very common way of handling errors. Within Microsoft flow this 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.
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.
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 possibilities are endless.
You could even consider restarting your flow in Power Automate if the flow fails because of an overload of you connector
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.