---
schema_version: "1"
id: 729e0c64c20f0d76728622c85bd556322760283593b6d942382ff6de93cce3e1
title: Try Scope XML Reference
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/mule-runtime/4.11/try-scope-xml-reference.md
canonical_url: https://docs.mulesoft.com/mule-runtime/4.11/try-scope-xml-reference
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 28b925c333d4b2bdaaf058f12123dcbf5c8bb1365c384b03f21483077b332ae2
description: MuleSoft Documentation Site
release: "4.11"
latest: false
---
---
product: Mule Runtime
version: 4.11
---

# Try Scope XML Reference

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

A Try scope follows the structure described below.

- A single root element `<try>`

- Components that are executed under the error-handling rules defined by the Try scope are defined
  as child elements of the `try` element. You can place one or many here.

- A single `<error-handler>` element holds all error handling strategies for the scope.

- In the error handler, one or several `on-error-continue` and `on-error-propagate` define 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-error` element. You can place one or many here.

```xml
<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
`error.cause.message.contains("fatal")`.

> [!NOTE] 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:

```xml
<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>
```

## Properties of Try

<table><colgroup><col> <col> <col></colgroup><thead><tr><th>Property</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><div><div><p><code>transactionalAction</code></p></div></div></td><td><p>INDIFFERENT</p></td><td><div><div><p>Defines if what’s in the scope is treated as a transaction. Possible values:</p></div><div><ul><li><p>INDIFFERENT : What’s in the scope isn’t treated as a transaction.</p></li><li><p>ALWAYS_BEGIN: A new transaction is started every time the scope is executed.</p></li><li><p>BEGIN_OR_JOIN: If the current processing of the flow has already begun a transaction, join it. Otherwise, begin a new one. (Only relevant when execution order may vary).</p></li></ul></div></div></td></tr><tr><td><div><div><p><code>transactionalType</code></p></div></div></td><td><p>LOCAL</p></td><td><div><div><p>Defines the type of transaction to use. Possible values:</p></div><div><ul><li><p>"LOCAL"</p></li><li><p>"XA"</p></li></ul></div></div></td></tr></tbody></table>

## See Also

- [Try Scope Concept](https://docs.mulesoft.com/mule-runtime/4.11/try-scope-concept)

- [Error Handling](https://docs.mulesoft.com/mule-runtime/4.11/error-handling)
