Contact Free trial Login

Custom Policy Exception Blocks Reference

You can define before and after exception blocks in custom policy definitions to enhance the catch exception strategy of a flow without the need to modify it. The following versions support the custom policy exception blocks:

API Gateway/Mule Runtimes:

  • v3.8.4 >= version < v4.0.0

  • v2.2.1 >= version < v3.8.0

  • v2.1.2 >= version < v2.2.0

The following diagram shows the happy path Before > Flow > After and the error path Before Exception > Exception Strategy > After Exception.

before after exception paths

Any exception in any part of the happy path stops the execution of the happy path and triggers execution of the error path. Any exception in either the before-exception or after-exception stops the execution of the error path. If the error is raised in the exception strategy, the after-exception is executed.

The following example custom policy shows how to implement before and after exception blocks:

<?xml version="1.0" encoding="UTF-8"?>
<policy id="1"

      <mule:logger level="INFO" message="The before block" />

       <mule:logger level="INFO" message="The after block" />

       <mule:logger level="INFO" message="The before exception block" />

       <mule:logger level="INFO" message="The after exception block" />

      <api-platform-gw:api-pointcut apiName="{{ apiName }}" apiVersion="{{ apiVersionName }}"/>

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.