How do I capture only specific exceptions?

omarhuff
edited May 1 in Flows

I'm trying to catch an exception, but I want to handle specific exceptions and have the exception thrown as usual for other exceptions. How would I go about doing this?

Comments

  • Caleb_Decisions
    edited May 1

    DISCLAIMER: If you're trying to catch an exception for only one step, please see: Exception Handling Best Practices (On Exception Outcome Path section)!!! If you need to catch a particular type of exception not specific to one particular step, the following steps may be helpful:


    If you use a catch exception step, you can check if the outputs of the catch exception step contains the exception you would like to handle. Please refer to the following example:


    In this flow, after the catch exception step, there's a String Contains step checking to see if the exception step name contains the word Email. If true, the flow goes down the true path, where you can handle that specific kind of exception; otherwise, it throws a non-catchable exception (so that the catch exception is unable to catch that exception as well).

    The throw non-catchable exception takes in the exception message, so that the end user will see the same exception message as they would if we weren't using the catch exception step; however, how you choose to handle either outcome is up to you!

    Because the first step in the flow is a divide step where we're dividing by zero, the flow will throw the following exception if run:

    The flow is able to throw exceptions as usual while still handling exceptions for all email steps.

Sign In or Register to comment.