question

$$ANON_USER$$ avatar image
0 Votes"
$$ANON_USER$$ asked $$ANON_USER$$ edited

How to capture ALL actions within a Scope including nested actions in a Condition

Hi I built a generic way of capturing the outcome of failed actions using the TRY/CATCH approach. It simple; I put all my logic inside the TRY scope, then then I run the CATCH scope if any action in the TRY fails. Where it isn't working as expected is when there is a condition action inside the TRY scope, and if something inside the condition fails. You can see from this basic example that we get inside the condition to the TRUE branch, and the DELETE FROM SQL action fails, which in turn marks the condition action as failed also. ![80747-image.png][1] When I get to the CATCH scope which has ran, the outputs of the TRY scope only includes the Condition action and not the DELETE FROM SQL action. So I can't capture the actual error from it. ![80649-image.png][2] Am I doing something wrong here or misunderstanding the power of using scopes? [1]: /answers/storage/attachments/80747-image.png [2]: /answers/storage/attachments/80649-image.png

azure-logic-apps
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

$$ANON_USER$$ avatar image
0 Votes"
$$ANON_USER$$ answered $$ANON_USER$$ edited

Some further testing makes me believe that a Condition action is itself it's own 'scope'. I populated an array variable with the result of the Condition @result('condition') and it has given me everything within that condition.

So if I want the results of the actions within a Condition, then I will need to do a 'catch' after each Condition.

This means I can't simply do 1 TRY scope and 1 CATCH scope (like I could if I really wanted to in C#, but I suppose I would have a stack trace to see were from the nested code the error was thrown) and have to be more explicit with how and what I do try/catch on.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.