Power Apps

Return Error in Power Automate When Using Try/Catch Scopes

actionscatchcloudflowerrorfinallyflowpower-appspower-automatetrytrycatchtrycatchfinally

When utilizing scopes within Power Automate to create a try/catch/finally statement it can be useful to provide additional details about any errors that occurred within the try block. The example below shows how to get the results of a try block after it has failed and return that information.

To replicate this do the following:

The iamge belows shows the output after a completed run. We can now see the Action name which failed as well as the error message. In this scenario I am using that information to populate a JSON object which will be used later for returning information back to a Power App.

2021-06-22_13-59-51

If you would like to return additional information from the Failed result test the flow in a way which will force it to fail then look at the flow run history. Expand the Catch block and click on the Filter Result for Failed action. You can see the body of what is returned in the result and utilize any of that additional information in generating your error message.

2021-06-22_14-42-10