Contact Free trial Login

Raise Error Component

This Core component generates a Mule Error, as if a failure had occurred, which allows you to customize its description and type.

Use this component to only raise core runtime errors, such as MULE:SECURITY, MULE:CONNECTIVITY, etc, or custom ones. You cannot raise an error from another connector or module like FILE:FILE_NOT_FOUND, JSON:INVALID_SCHEMA. You cannot use a connector’s existing namespace.

For core runtime errors types, you must use the implicit namespace and identifier, you can only customize the error’s description message.
For custom error types, declare a new namespace. The namespace of an error type should help you identify the origin of an error.
You cannot use existing namespaces from connectors or modules, since these have their defined namespaces. Once you declare a custom namespace by using it in a raise-error, you can use it in other raise-error components and custom types.

The following example flow produces an ACCOUNT:INSUFFICIENT_FUNDS error when a transfer amount surpasses the available balance, preventing the transfer from taking place. Additionally, it generates a dynamic description by providing an expression with failure details.

Example: XML Configuration of the Flow
<flow name="raise-error-example-flow">
  <http:request url="" target="balance"/>
      <when expression="#[payload.amount > vars.balance]">
          <raise-error type="ACCOUNT:INSUFFICIENT_FUNDS" description="#['Cannot transfer $(payload.amount) since only $(vars.balance) are available.']"/>
  <http:request url=""/>

This example raises an error with a static description and features a custom type using the ORDER namespace:

 <raise-error description="Email is invalid. Cannot complete transaction." type="ORDER:INVALID_DATA"/>

Raise Error Configuration

Field Value Description Example


String or DataWeave expression

Specifies the error description.

description="Invalid email. Cannot complete transaction."



Specifies the type of the error.


See also

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub