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"
Advertisement

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.