BA-IT
Tous les articles
Power Automate November 30, 2024 1 min

Improving Workflow Error Management in Power Automate with TRY-CATCH

A flow that fails silently for three weeks is a flow nobody knew about - until the customer calls. Here is a reusable TRY-CATCH pattern to take back control.

Why this pattern matters

Production errors often go unnoticed. Admins discover incidents without context, developers hear about them from end users. A real TRY-CATCH detects failures the moment they happen, alerts the right people with the right details, and links straight to the failing run.

General structure

  1. A TRY scope containing the business logic.
  2. A CATCH scope that only runs on failure, skip or timeout of the TRY.
  3. Inside the CATCH: metadata capture, run URL, notification, clean termination.

1. The TRY scope

Create a Scope named TRY and put every workflow action inside it - except variable declarations, which stay outside to remain visible from the CATCH.

2. The conditional CATCH

Add a second Scope named CATCH. In Configure run after of the CATCH, tick has failed, is skipped and has timed out for the TRY. Untick is successful.

3. Capture workflow metadata

Inside the CATCH, add a Compose that calls workflow(). It returns a JSON object with the flow id, environment id and current run id.

@{workflow()}

4. Rebuild the run URL

https://make.powerautomate.com/environments/{envId}/flows/{flowId}/runs/{runId}

5. Notify admins

  • To: environment variable holding the admin list - never hard-coded.
  • Subject: flow name + failure type.
  • Body: a clear message plus the rebuilt run URL.

6. Terminate cleanly

Last action of the CATCH: a Terminate with status Failed and an explicit message, so the failure shows up correctly in the run history.

What you gain

  • Immediate alerts with full context.
  • A clickable link straight to the failing run.
  • A clean failure status in history - no more false-positive greens.
  • A reusable pattern across every business-critical flow.

Wrap up

Setting up TRY-CATCH takes twenty minutes and pays off on the very first incident. On a production Power Automate tenant, it is a standard, not an option.

Un projet Power Platform en tête ?

Cadrage, audit, développement ou déblocage d'urgence - parlons-en.