Logic Apps Error Handling in Serverless360 BAM | Serverless360
← Return To Home

Azure Logic Apps Error Handling Using Serverless360 BAM



A few weeks ago, my good friend Josh Cook wrote a blog post for Power Automate about getting the error message when implementing the try/catch pattern with a Flow.  We discussed if this could be used with Logic Apps, and Josh confirmed that it could, even though the Logic App documentation doesn’t cover it very well.  Josh’s original Flow post is- Grabbing an error message from a failed run.

Following this great find, I wanted to check if we could then send the error message to Serverless360 BAM so I can access it for troubleshooting.

Logic App

In my Logic App below, I have implemented the try-catch pattern where the catch scope only executes if the try scope fails.

Logic App

Inside the catch scope, I have a BAM Checkpoint action to tell Serverless360 that my BAM milestone failed.  Before I call the checkpoint, I need to format my error message as Logic Apps will give me quite a detailed error message, and I only want certain information to be sent to BAM.  To do this, we will first parse the result message from the try scope just like Josh did in his Flow post.

Parse result

The result expression we used as the input is shown below

Logic App Error Handling

In this article, I did want to make one slight change to what Josh does in his Flow post.  When I have the result from the try scope, it also included all of the skipped shapes, which might end up with a bunch of noise in a big error message, so I wanted to filter the error message, so I push to BAM the necessary info about what failed.  In the below Filter shape, I can filter the array to get only actions which failed.

Filter array

Next, I am going to use the Select shape as Josh did, but as I only now have the failed actions, I found that some steps may have slightly different info depending on what the action does, so I am going to take the entire action output to use as the error message.


I think this bit may vary on what is best on a per Logic App basis but try it out and see what works best for you.

How Serverless360 BAM helps in Logic App Error Handling?

I can now pass the output from the select shape to the exception property on the BAM checkpoint call, which will push my error message to BAM.

Serverless360 BAM

The contents of the catch block look like the below:


When I run my Logic App now and an error, this catch block will kick in, and I will send the error info to BAM.

When I look at my BAM tracking data in Serverless360 I can then see that my BAM transaction failed at the Batch Complete stage.

BAM tracking data

When I click on the stage that got the error, I can now see the error message passed to BAM from the Logic App.

Error message

In this case, you can see I have the output message from the Logic App Http shape that failed, and I have the headers and the body with the invalid key error message.  I am sure there is more I can do to tidy up the error message if I wanted.

Logic App

Wrap Up

Hopefully, this little walkthrough will show you how the excellent find from Josh can also help us in Logic Apps and send errors to BAM in Serverless360 to make it easier to support troubleshooting our Logic App solutions.

Author: Michael Stephenson

Mike is a very highly experienced leader when it comes to delivering real-world cloud solutions having worked on >40 projects with many multiple large customers. He has worked with Microsoft Azure technologies since they first came out and has lead the technical side of the cloud adoption at a number of companies and has helped those companies become recognized by Microsoft as the benchmark for cloud adoption in their industry sectors.