cancel
Showing results for 
Search instead for 
Did you mean: 

Get Error code in flow

Following the changes to error handling, im trying to send a email containing the error status and message.
I do receive a message when the flow fails, but how do i include the failure information in that email ???

Previous request: https://powerusers.microsoft.com/t5/Flow-Ideas/Error-handling-when-action-fails/idi-p/16526

Tutorials: https://blogs.msmvps.com/windsor/2019/04/25/microsoft-flow-error-handling/
https://veenstra.me.uk/2018/06/06/microsoft-flow-advanced-error-handling-throw-in-flow/

body('Get_Item')?['Status']
body('Get_Item')?['Source']
body('Get_Item')?['Message']

Results: "Status: , Source: , Message: "

Those 3 values are empty.... So now i can trigger an action if there is a failure, but there is no way to know what failed, no error code and no error message.

How can i get the error message and error code and trigger a different action in flow depending on the error code ??
Status: New
Comments
abhijithshastry
Advocate II

Hello,

This expression should help - actions('<Name of the action>').error.message

Murderbot
Advocate IV

It looks like MS has changed the error reporting method recently and I am able to pull the detailed error message from an action with

body('<action name>')['errors']

. Unfortunately, I haven't figured out a way to make this statement dynamic - you have to reference a particular action (can't use variables or nested statements).