This sample explains about basic fault handling. In fault handling, <throw/> and <rethrow/> are used to generate faults where faults occurs.
eg -
<throwfaultName="saw:InputException2"/>
eg -
<catchAll><rethrow/></catchAll>
eg -
<faultHandlers><catchfaultName="saw:InputException2"><throwfaultName="saw:Exception1Handled"/></catch><catchAll><rethrow/></catchAll></faultHandlers>
Note - <faultHandlers/> should be defined in a parent scope.
Refer - TestThrowCatchFaultHandling.zip
In the child scope the input value is checked whether it's equal to 1. If so an
InputException1 is thrown. Note that the thrown exception has a "saw:InputException1"
qualified name.
eg -
<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.
eg -
<faultHandlers><catchfaultName="saw:InputException1"><ifname="ExceptionCondition2"><condition>true()</condition><throwfaultName="saw:InputException2"/><else><throwfaultName="saw:TransitionConditionOutOfRangeException2"/></else></if></catch></faultHandlers>