Handle Errors in Flows
Proper error handling ensures your flows are resilient and provide meaningful feedback when issues occur with document generation.
Configure Run After
Power Automate’s “Configure run after” feature lets you control when actions execute based on the outcome of previous actions.
Setting Up Error Handling
- Add an action after your Build a Doc action
- Click the … menu → Configure run after
- Select the conditions:
- is successful
- has failed
- is skipped
- has timed out
Parallel Error Branch
Create a parallel branch that only runs on failure:
Build a Doc Action├── [Success path] Create file in SharePoint└── [Failure path] Send error notification emailUsing Scope for Try-Catch
Scope actions let you group related actions and handle errors at the group level.
Try-Catch Pattern
Scope: Try├── Get file content├── Build a Doc: Convert Word Document└── Create file
Scope: Catch (Configure run after: Try has failed)├── Compose: Error details├── Send email: Error notification└── Terminate: FailedConfiguration Steps
- Add a Scope action, rename to “Try”
- Add your Build a Doc actions inside the Try scope
- Add another Scope after Try, rename to “Catch”
- Configure Catch to run after Try “has failed”
- Add error handling actions inside Catch
Accessing Error Information
Use expressions to access error details:
Error Message
result('Build_a_Doc_Action')?['error']?['message']Full Error Object
result('Build_a_Doc_Action')?['error']Action Status
actions('Build_a_Doc_Action')?['status']Action Outputs (including errors)
actions('Build_a_Doc_Action')?['outputs']Common Error Scenarios
401 Unauthorised
Handling:
if equals(result('Action')?['statusCode'], 401) → Send notification about invalid API key → Terminate flow429 Rate Limited
Handling:
- Enable retry policy with exponential backoff
- Add delay between document generations in loops
Template Errors
Handling:
- Enable “Inline template syntax errors” in the action
- Errors appear in the output document instead of failing
- Good for development and debugging
Timeout
Handling:
- Increase timeout in action settings
- For large documents, consider breaking into smaller parts
Logging Errors
Teams Notification
Use the Teams connector to post error messages to a channel for team visibility.
- Add Microsoft Teams → Post a message in a channel
- Select Team or Channel to post to
- Set Message to include error details and timestamp
Trigger the action from the Catch scope
Best Practices
- Always add error handling - Don’t assume actions will succeed
- Log errors - Maintain an audit trail for troubleshooting
- Notify appropriately - Alert relevant people without creating noise
- Use inline errors during development - Faster debugging
- Test failure scenarios - Intentionally trigger errors to verify handling
- Terminate failed flows - Don’t let failed flows continue silently