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.
According, to my old article. Add “Try Catch” scopes. Our flow became:
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')
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:
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 Flow:
Finally, in case of error, here is the detail:
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!