CategoriesPower Automate

Power Automate – Get Action Error Details

In this article, let’s see how you can catch error during flow executions and send information via email. My way to catch error is by incorporating error handling , and track in log table or SharePoint list on you can also send and email with error details. First of all, if you didn’t , you should read my old article “Power Automate – Try Catch”.

Our Flow

Basically, we have a Power Automate flow with manually trigger who catch wheater informations and log them in SharePoint list.

Power Automate Flow without error handling

According, to my old article. Add “Try Catch” scopes. Our flow became:

Simple flow

In this case, my “Catch” scope, is configured to execute only in case of:

  • has failed
  • Is skipped
  • has time out

Basically, now you can add some action to track if your flow going in error and send alert to users. By, let’s do a little additional step, and get error details.

Get errors details

How can we get error details?

In our “Catch” scope, we shuld add “Compose” block to get output result of our “Try” scope, then, we should filter result to extract error details.

Key Point:

Get “Try” scope result, with compose: (you must use “Get result” action)

result('Try')
Get Try result

Now, use “Filter array” action, to filter “Get-Try-Result” result action. In filter, I added this:

item()?['Status']

and filter for “Is Equal” to “Failed”, so final result is:

Filter error in Catch block

Now you can send email with details or track them on list (or both 🙂 ). You can get Action Name, with this expression. To try , I added bool variabile, and set to null in “try” scope.

body('Filter_Result')[0]?['Name']

And error details:

body('Filter_Result')[0]?['Error']

So , final result of “Catch” scope is:

Final result of catch scope with error handling

Final Flow:

Complete flow with error handling.

Finally, in case of error, here is the detail:

Error details

Considerations

I hope these information can help you! Leave me a comment to let me know what you think, or if you have a better idea to handle this case.

Contact me for questions! Have a nice day!

CategoriesPower Automate

Power Automate – Try Catch

Hi, Today I want to explain how to implement “try-catch” (and “Finally” also if you need). It’s very simple…basically you should add “scope” , put actions inside, add another “scope” to manage error…let me show:

1) Add “Main” scope with your actions inside:

2) Add another scope. I called it “Catch” …it contains some actions to execute if  error in “Main” scope should occur:

Now, we must configure “Run after” on this scope to execute it in case of error:

If you want , you can add also “Finally” scope to execute some actions in any case…your flow should be appears like this:

That’s all! Personally I use these scope to write log in case of error and success also.

Thanks

My Agile Privacy
This website uses technical and profiling cookies. Clicking on "Accept" authorises all profiling cookies. Clicking on "Refuse" or the X will refuse all profiling cookies. By clicking on "Customise" you can select which profiling cookies to activate.
Warning: some page functionalities could not work due to your privacy choices