Try Scope XML Reference
A Try scope follows the structure described below.
A single root element
Components that are executed under the error-handling rules defined by the Try scope are defined as child elements of the
tryelement. You can place one or many here.
<error-handler>element holds all error handling strategies for the scope.
In the error handler, one or several
on-error-propagatedefine the various strategies. At least one of these must be present.
Components that are executed when a matching error occurs are defined as child elements of the
on-errorelement. You can place one or many here.
1 2 3 4 5 6 7 8 9 10 11 <try> <!-- COMPONENTS TO TRY TO USE --> <error-handler> <on-error-continue> <!-- COMPONENTS TO USE IN CASE OF ERROR --> </on-error-continue> <on-error-propagate> <!-- COMPONENTS TO USE IN CASE OF ERROR --> </on-error-propagate> </error-handler> </try>
Each error handling strategy in a Try scope (
on-error-*) follows a condition. This condition is typically an error type (or a list of several) which must match the current error. You can also define this condition as a freely written expression, such as
|Note that conditions are evaluated in order and only the first strategy to match is executed.|
Below is an example that includes two error handling strategies, each executing a logger component:
1 2 3 4 5 6 7 8 9 10 11 <try> <http:request config-ref="HTTP-config" method="GET" path="/" /> <error-handler> <on-error-continue enableNotifications="true" logException="true" type="CONNECTIVITY"> <logger level="INFO" doc:name="Logger" message="Connectivity Error"/> </on-error-continue> <on-error-propagate enableNotifications="true" logException="true" doc:name="On Error Propagate" type="EXPRESSION"> <logger level="INFO" doc:name="Logger" message="Expression error" /> </on-error-propagate> </error-handler> </try>
Defines if what’s in the scope is treated as a transaction. Possible values:
Defines the type of transaction to use. Possible values: