When building Power Automate flows, it’s important to include error handling in case a flow fails. Doing so can save you significant time managing support tickets and troubleshooting.
Today, I’m going to share the Try-Catch-Finally approach and explain how to implement it in your Power Automate flows. This proactive strategy keeps you informed with detailed error information such as the failed action name, the request code (for example, BadRequest), the error code (for example, InvalidTemplate), the error message (for example, “Attempt to divide an integral or decimal value by zero in function ‘div’.”), and even a direct link to the failed flow run.
How to implement your own reusable error handling template
First, add three Scopes with the following names: Try, Catch, and Finally. Then, configure the “Run after” settings for the Catch and Finally scopes as shown in the screenshot below.
Try-Scope
The Try scope is where you will nest all the actions of the flow, except for initializing variables.

Catch-Scope
If any action inside the Try scope fails or times out, the Catch scope will trigger. In this scope, you can capture the error message and notify the administrators.


Capturing the Error Message
To capture the error message, use the result() expression inside a Filter array action:
- From: result(‘Try’)
- Filter Condition: “@or(equals(item()?[‘status’], ‘Failed’), equals(item()?[‘status’], ‘TimedOut’))”
This ensures that only failed or timed-out actions within the Try scope are filtered for error handling.

Using the Filter Array Output for Notifications
Once the Filter array action captures failed or timed-out actions, you can use its output to send an email or Teams message to notify the administrators.

[
{
"name": "Compose_2",
"startTime": "2025-03-16T12:45:03.6385026Z",
"endTime": "2025-03-16T12:45:03.6391146Z",
"trackingId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"clientTrackingId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"clientKeywords": [
"testFlow"
],
"code": "BadRequest",
"status": "Failed",
"error": {
"code": "InvalidTemplate",
"message": "Unable to process template language expressions in action 'Compose_2' inputs at line '0' and column '0': 'Attempt to divide an integral or decimal value by zero in function 'div'.'."
}
}
]
Sample email notification

Finally-Scope
The actions inside the Finally scope will always execute, regardless of whether the Try and Catch scopes succeed or fail.


Conclusion
By using this simple approach, you can ensure that you stay notified about your flow runs and maintain better visibility into errors and execution statuses.