1. Home
  2. Exception Handling

Exception Handling

◷ Reading Time: 2 minutes

Introduction

Exceptions are the errors that can occur during the execution of a project, disrupting the flow. This can happen due to different reasons and the exception message provides a detailed description of the cause.

Therefore, it is a good practice to catch the exceptions before it crashes the flow. For example, when an exception occurs, you can show the exception message (what caused the error) and how to fix it, instead of stopping the whole flow without any explanation.

In FlexRule Designer, you can assign exceptions using a transition or Try node.

1. Assigning to a transition: when there is one node to catch exceptions

2. Using a Try node: when there are multiple nodes to catch exceptions

Examples

Assigning to a transition

If a flow contains a database connection, there can be exceptions due to multiple reasons.

  • The exception handling properties should be set to a transition that comes out of the node. In this example, it is the transition that connects the Database node and the Notification node.
  • The error is assigned to a variable named error.

Properties

  • Type: System.Exception
  • Exception: error = $context.Exception.Message|asString()

Using a Try node

Follow this link to see how to use the Try node.

Download

Downloadable sample project (Exception_Handling.zip) using the attachment at the end of the page.

Updated on July 9, 2019

Article Attachments

Was this article helpful?