Pattern for Microsoft Flow error handling

Errors happens. In Microsoft flow the error handling mechanism is pretty simple : you just need to click on the Configure run after setting of any action of your flow:

flow1

By default, this option is set to is successful : if the previous action run was successful, then the current action can run:

flow2

 

If I set ‘has timed out” that means the send e-mail action will run if the start approval runs into timeout

flow3

When action is used to manage an error, its associated arrow become dash red :

flow4

As illustrated before in a previous post, I also use this as a way to escalate approvals : for instance by adding a parallel branch:

flow5

(click for zooming)

flow6

For more details on this, check my previous blog post. You should also keep in mind that every time an approval runs into a timeout, it is removed from the Flow approval center (therefore you don’t see the real history).

 

But the point is by default  a flow could look like this: with a general scope and an error handler scope:

flow8

variable declarations can not be done in scope at the time of this writings, but usage of Compose actions works.

 

…and if needed we can even add specific error handler in the Main Code

flow7

My advice is provide a general error handler that runs if the general scope has failed or is skipped or has timeout.

My wish

Now I wish we could do much more : for instance a Flow run time is limited to 30 days, I wish I could check the timeout of a scope and start some specific action 1 day before the timeout; but there is no settings where we could define such timeout in Scopes as we do in the approval action.

 

 

Leave a comment