web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Nested Try/Catch desig...
Power Automate
Unanswered

Nested Try/Catch design approaches

(0) ShareShare
ReportReport
Posted on by 23

Hi All.

 

The organisation I'm working for have set up a basic flow template structure which essentially compresses of a top-level try / catch scope.  The 'try' would contain all the main actions of the flow, with the 'catch' handling failure & timeouts, and translates the cause of the failure and notifies an administrator via email.  This was primarily done because we had a number of flows that were faulting and we weren't aware of them.

 

However, I'm working on a number of new flows, while trying to adopt this established template structure, where some actions will legitimately fail, and decisions need to be executed based on these legitimate failures.  The problem that I am having is that these legitimate fails are triggering the 'catch' error handling.

 

In essence, what I really want to do is have nested try/catches as you would in other, traditional programming languages / environments.  I've tried this approach and it makes no difference - any failure eventually percolates down to the top-level 'catch' scope.

 

Does anyone have any design suggestions (other than split everything) or is it possible to cancel a failure some how so it doesn't cascade down?

 

Many thanks in advance

 

Mike

Categories:
I have the same question (0)
  • MC-05081019-0 Profile Picture
    23 on at

    Hay Chriddle,

     

    Thanks for the help and support.  I've replicated exactly what you have done and I can confirm that it works as you have stated, and solves my problem.

     

    It seems that by adding the 'finally' scope, on the internal try/catch, and setting its run after to include everything, it effectively mutes the failure and prevents it from filtering down to the external try/catch.  Without the inclusion of this 'finally' scope, any internal failures progress on to the external catch.

     

    In some ways this logic makes sense (I guess) but its also a little illogical.  In other programming paradigms, a 'catch' statement would intercept an exception (or all exceptions) and potentially handle them, without them progressing outside of the catch statement.

     

    Anyway, all sorted now - thank you for your help

  • Chriddle Profile Picture
    8,470 Super User 2025 Season 2 on at

    There is nothing special in my flow.
    Each Try scope's run after is set to ["is successfuel"], each Catch scope is set to ["has failed", "has timed out"]
    and each Finally has checked all options.

     

    If the last action of a scope fails, then the scope fails. Maybe your inner catch fails? Without a "Finally" this would cause the outer Catch to run.

     

     

  • MC-05081019-0 Profile Picture
    23 on at

    Exactly like that...

     

    How did you achieve it? 🙂

     

    I have a top-level try/catch scope, and if I add another try/catch scope within the main (top-level) try scope, configured in exactly the same manner (i.e. the 'catch' is set to run on failure or timeout) any failure in the internal 'try' filters down to both 'catches'...

  • Chriddle Profile Picture
    8,470 Super User 2025 Season 2 on at

    Something like this?

    Chriddle_1-1687795559372.png

     

    I always add a "Finally" so I only need to mess with runafter settings within these scopes.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 258 Super User 2025 Season 2

#2
trice602 Profile Picture

trice602 205 Super User 2025 Season 2

#3
Expiscornovus Profile Picture

Expiscornovus 204 Most Valuable Professional

Last 30 days Overall leaderboard