com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.

Fault Handling

Objective

This sample illustrates the basics of fault handling.

Introducing the <throw> Construct

In fault handling, <throw/> and <rethrow/> are used to generate faults where faults occurs.

<throw/>

Faults should be named with a unique scope level qualified name. For example,

<throwfaultName="saw:InputException2"/>
<rethrow/>

Used only inside <catch/> or <catchAll/>, which will be described later in order to re-throw the originally caught exceptions. For example,

<catchAll><rethrow/></catchAll>

 Fault handling is implemented inside <faultHandlers/>. Faults can be handled based on qualified name of the thrown fault using <catch/> or every non-specified faults can be handles inside <catchAll/>. For example,

<faultHandlers>
   <catchfaultName="saw:InputException2">
        <throwfaultName="saw:Exception1Handled"/>
   </catch><catchAll>
   <rethrow/>
   </catchAll>
</faultHandlers>

Note

<faultHandlers/> should be defined in a parent scope.

Deploying the Sample

WSO2 BPS provides a sample, which can be deployed and executed to understand fault handling. Follow the instructions below to deploy and trigger the process.

1. Log in into BPS server management console and select "Processes -> Add" under the "Main" menu.

2. Upload the <EI_HOME>/samples/business-process/bpel/ThrowCatchFaultHandling.zip directory. 

3. In the "Deployed Processes" window, click the "Process ID" to access its "Process Information" window.

4. Under the "WSDL Details" widget, trigger the process using the "TryIt" link to create an instance of it.

Example Usage

Refer ThrowCatchFaultHandling.zip. In the child scope the input value is checked to see if it is equal to 1. If so, an InputException1 is thrown. Note that the thrown exception has a "saw:InputException1" qualified name. For example,

<ifname="ExceptionCondition1">
       <condition>number($value)=number(1)</condition>
       <throwfaultName="saw:InputException1"/>
       <else>
          <throwfaultName="saw:TransitionConditionOutOfRangeException1"/>
       </else>
</if>

In the parent scope, the exception is filtered against its qualified name. For example,

<faultHandlers>
    <catchfaultName="saw:InputException1">
         <ifname="ExceptionCondition2">
              <condition>true()</condition>
              <throwfaultName="saw:InputException2"/>
              <else>
                  <throwfaultName="saw:TransitionConditionOutOfRangeException2"/>
              </else>
         </if>
    </catch>
</faultHandlers>
com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.