VOOZH about

URL: https://www.javacodegeeks.com/2022/05/how-to-add-error-handling-to-a-flow-and-continue-execution-when-an-error-occurs.html

⇱ How to Add Error Handling to a Flow and Continue Execution When an Error Occurs - Java Code Geeks


Okta Workflows how-to guides are questions and answers from weekly community office hours, MacAdmins Workflows Slack channel, and other places. Read all previous how-to guides.

On to the question.

How to add error handling to a flow and continue execution when an error occurs?

When a card execution fails, the flow execution will stop. Any cards after the error card will not be executed.

For example, in the screenshot below, API call fails, the flow stops executing and the Assign card is not processed.

👁 Image
Card execution error

Another example where flow execution stops is when Read User card results in an error (when providing an invalid user ID).

👁 Image
Card execution error

You want to be able to gracefully handle the error and continue the flow execution. To do that use the Error Handling – If Error card.

The If Error card has two sections: Try and If Error. You will try something and if it fails, the if error logic will be called and will allow you to continue the flow execution.

Using the API example from above, this is how the Try section looks. You place cards inside the Try section.

👁 Image
If Error card – Try section

This is how the If Error section looks. You add any cards to process the error.

👁 Image
If Error card – section to handle error

The If Error card allows to define output. Based on which path is taken, the Number will be set to either 100 or -100.

Tip: Learn how to create outputs for an If/Else card

How-to Guide: How to Handle an External API Call Error in Workflows

If the flow generates an error, the If Error card handles the error and the flow execution continues. The Assign card outside of If Error was processed.

👁 Image
Flow execution continues after an error

In the same way you can place Read User inside the Try section of If Error card.

👁 Image
If Error card – Try section
👁 Image
If Error card – section to handle error

Even though the Read User cards results in an error the flow execution continues. The Assign card outside of If Error was processed.


Published on Java Code Geeks with permission by Max Katz , partner at our JCG program. See the original article here: How to Add Error Handling to a Flow and Continue Execution When an Error Occurs

Opinions expressed by Java Code Geeks contributors are their own.

Do you want to know how to develop your skillset to become a Java Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. JPA Mini Book
2. JVM Troubleshooting Guide
3. JUnit Tutorial for Unit Testing
4. Java Annotations Tutorial
5. Java Interview Questions
6. Spring Interview Questions
7. Android UI Design
and many more ....
I agree to the Terms and Privacy Policy

Thank you!

We will contact you soon.

👁 Photo of Max Katz
Max Katz
May 11th, 2022Last Updated: May 9th, 2022
0 202 2 minutes read
Back to top button
Close
wpDiscuz