Performing Exception Handling

Objective

After completing this lesson, you will be able to Perform exeption handling.

Exception Handling

In this Lesson, the Following Topics are Discussed:

  • What is an Exception?
  • Define Error Configuration for one integration flow to inform the Sender.
  • Define an Exception Subprocess.
  • Error Handler.
  • Error and Escalation events.

What is an Exception?

There are typically two types of exceptions: expected and unexpected. Expected exceptions may include different values in a message field or empty values, and can be handled through the integration flow design. Unexpected exceptions, on the other hand, are usually technical in nature, such as connection failures or errors in scripts, and can lead to program termination. To prevent this, unexpected errors must be intercepted and handled appropriately to allow the program to continue running.

The focus now shifts to unexpected exceptions and their handling, and for the remainder of this discussion, the terms "unexpected exceptions", "exceptions", and "errors" will be used interchangeably.

Define Error Configuration for one Integration Flow to Inform the Sender

You can specify the error handling mechanism for handling runtime failures during message processing. The primary objective of this approach is to communicate error details to the sender for better awareness. To achieve this, you can enable the Return Exception to Sender flag in the integration flow settings.

Read more here:

Define Error Configuration

Define an Exception Subprocess

An additional subprocess can be defined within an integration flow, which will be invoked whenever an unexpected error occurs.

Procedure

  • In an editable flow, you may want to retrieve an exception to ensure that the original process is completed without any errors.
  • Place an Exception Subprocess.
  • Define your error handler.
  • Save, deploy, and run your integration flow.

Sample

Your integration flow has encountered an error as the connection parameters are not functional.

The error in the message monitor after deployment:

Usage of an exception subprocess:

The starting event is an Error Start event. This component fetches the exception.

The monitor with the exception subprocess:

You can view the detailed error information inside the Message Processing Run.

Error Handler

If the error is caught by an Error Start event, any further processing can be implemented as in a regular process. Scripts, like the one demonstrated in Handle Exceptions, are especially common.

Error and Escalation Events

The Error Start event always triggers the Exception Subprocess, which intercepts the error and starts its execution. If you want to terminate the Exception Subprocess without the status Failed, you need to define an End Message, as shown in the example above.

Manual Generation of Error and Escalation End Events

Setting an Error End event at the end of an integration flow will always cause it to enter the Fail status, which can be utilized as a design element. The Error End event serves as the endpoint of the main process, and in case of any errors, the Exception Subprocess always intercepts it.

Run to an Error End Event:

If you get the Failed status, then the process worked correctly.

The Escalation End event generates an error without interrupting the main process.

Run to an Escalation End Event:

If you get the Escalated status, then the process worked correctly.

Summary

A special error subprocess can intercept an unexpected error using an Exception Start Event. After interception, various processing steps can be implemented. For instance, it would be appropriate to store process values or message content following an error. Additionally, informing the sender about the error can also be configured.

Create an Exception Process

Business Scenario

We will now add error handling to intercept unexpected errors, which is necessary for every HTTP call since the connection may not be established from time to time. To achieve this, we will utilize our own Exception Subprocess.

Task Flow

In this exercise, you will perform the following steps in one task:

  1. Log on to the integration flow DelayedDelivery_Process.
  2. Create and configure an Exception Subprocess.
  3. Learn more about the Exception Subprocess.

Prerequisites

A subprocess to handle exceptions should be added by you.

Outcome After This Exercise

You will have implemented an Exception Subprocess that handles errors in your integration flow.

What Do You Learn Within This Exercise?

Learn to create and use an Exception Subprocess.

Exercise Options

To carry out this exercise, you can choose from the following options:

  1. Live Environment: Using the instructions provided below, you can perform the steps in your SAP BTP account.
  2. Platform Simulation: Follow the step-by-step instructions within the simulation.
  3. Side-by-side: Follow the step-by-step instructions within the simulation and perform the steps in your SAP BTP account simultaneously.

Note

We strongly recommend to perform the steps in the live environment.

Task 1: Create an exception Process

Steps

  1. Log on to the integration flow DelayedDelivery_Process via Integration Suite.

    1. Navigate within the Integration Suite Welcome page to Design > Integrations > DelayedDelivery_Package_randomNumber > DelayedDelivery_Process.

    2. Following the status after the last exercise step.

    3. Imagine that the integration flow has been further edited.

  2. Create and configure an Exception Subprocess component.

    1. Choose ProcessException Subprocess.

    2. Ensure that there is enough space in the swim lane to accommodate the subprocess before placing it in a free area.

    3. Rename it to Exception Subprocess.

    4. The subprocess is traversed in case of an error, but no actions are taken based on it.

  3. Learn more about the Exception Subprocess.

    1. Navigate to Exception Subprocess, open the configuration bar of the Exception Subprocess component, and choose the question mark symbol.

Log in to track your progress & complete quizzes