Power Automate Error Exception

 In Power Automate, the expression:

actions('Try')?['error']?['message']

is used to retrieve the error message from a failed action—typically inside a Scope, Try/Catch pattern, or Configure run after setup.



What This Expression Does

  • actions('Try') → Refers to the action named Try (usually inside a Try scope).

  • ?['error'] → Safely navigates to the error object (using ? prevents failure if it doesn't exist).

  • ?['message'] → Retrieves the actual error message string.

So effectively, this expression gives you the error message produced by the Try action.


🧩 Where You Use This

Typically inside the Catch scope of a “Try → Catch → Finally” pattern in Power Automate:

  1. Create a Scope called Try

  2. Create a Scope called Catch

  3. Set Catch to run only when Try has failed

  4. Inside Catch, use the expression above to extract the error


πŸ“Œ Example: Compose Action Inside Catch

Add a Compose action and insert:

actions('Try')?['error']?['message']

This gives you something like:

"The execution of template action 'SomeAction' failed: The API returned an invalid response..."

πŸ” Safe Navigation (Why the ?)

Using ? prevents your flow from failing if:

  • There is no error object

  • The action didn't produce a message property

Without ?, your flow may fail trying to access a missing property.


πŸ“ Notes

  • The action name must match exactly (case-sensitive).

  • You can also retrieve:

    • Error codeactions('Try')?['error']?['code']

    • Error detailsactions('Try')?['error']?['details']


Comments

Popular posts from this blog

πŸ” Dataverse + Azure Integration: Choosing Between Synapse Link and Microsoft Fabric

⚡ Example: Rate Limiting in Azure API Management

In-Process vs Isolated Process Azure Functions: What’s the Difference?