← Back to Tips & Tricks
Power Automate
Implement Scope-Based Error Handling in Flows
Use Scope actions with 'Configure run after' to create robust try-catch-finally patterns in Power Automate.
Why Error Handling Matters
Flows without proper error handling can fail silently or leave processes in inconsistent states. Scope-based error handling gives you control over what happens when things go wrong.
The Try-Catch-Finally Pattern
Create three Scope actions to implement robust error handling:
1. Try Scope
Contains your main business logic - the actions that might fail.
2. Catch Scope
Configure to run only when Try scope fails:
- Click the three dots on the Catch scope
- Select "Configure run after"
- Check only "has failed"
3. Finally Scope
Runs regardless of success or failure - great for cleanup tasks:
- Configure run after: "is successful", "has failed", "is skipped"
Example: Processing Orders
Try Scope:
- Get order details
- Update inventory
- Send confirmation email
Catch Scope (runs if Try fails):
- Log error to SharePoint
- Send alert to admin
- Revert partial changes
Finally Scope (always runs):
- Update audit log
- Release any locks
Accessing Error Details
In your Catch scope, use these expressions to get error information:
// Get the error message
result('Try_Scope')?['error']?['message']
// Get the full error object
actions('ActionName')?['outputs']?['body']?['error']
Always notify someone when errors occur in production flows. Silent failures are the hardest to debug.