Hi there 🙂
For many programmers, the concept of a try/catch block is very familiar – you have a section of code that executes (the ‘try’ block), and if within that section an ‘exception’ occurs, the ‘catch’ block will then execute.
Fortunately, Logic Apps does have an exact equivalent for this 🙂 I will place it below.
(FYI – I did steal part of what’s below from another post I just made, but it applies to this post as well so I’m borrowing it 🙂 )
To implement a try/catch equivalent in Logic Apps, you can do the following
1) Add a ‘Scope’ block
2) Now that a ‘Scope’ block is in place, whenever an ‘exception’, or more specifically, an action or block ‘fails’ within the Scope block, you can handle that ‘exception’ (or ‘fail’) by adding another step after the ‘Scope’ block. You can now click on the ellipses located to the right of the title of the newly added block, and select the ‘Configure run after’ option, choose the ‘has failed’ option, and now, this newly added block will run whenever the ‘Scope’ block fails.
3) Note that you can also add another action after the ‘Scope’ block and you can set the ‘Configure run after’ to ‘has succeeded’, and then this block will execute when the ‘Scope’ block does not throw an exception (ie does not fail)
And there you have it! A Scope block, a block that runs after the Scope ‘has failed’, and thus basically the same building blocks that a try/catch block would do 🙂
Hope this helps!