# Error mapping and Raise Error custom types

*MuleSoft Developer Study Guide · Handling Errors · Last updated October 28, 2026 · https://www.certifyforce.com/study-guide/mulesoft-developer/handling-errors/error-mapping-and-raise-error-custom-types*

Turn one connector error into distinct custom types with an error-mapping on each operation, raise core or custom error types with Raise Error and a DataWeave description, and pick a custom namespace that no connector already uses.

- Certification: Salesforce MuleSoft Developer
- Exam section: Handling Errors
- Study guide: https://www.certifyforce.com/study-guide/mulesoft-developer

**Official exam objective:**

> Apply correct processors/syntax to map custom errors, and predict outcomes.

## What the exam expects

- Add an `<error-mapping sourceType targetType>` to an operation so the same connector error from two operations reaches different On-Error components.
- Write a Raise Error component with a valid `type` (core runtime type or custom namespace) and a static or DataWeave `description`.
- Predict the payload and response when a raised custom error is handled, using `error.description` and `error.errorType`.
- Choose a custom namespace that identifies the app's domain and avoids connector namespaces.

Key terms:
- **Custom error type**: an error type in a namespace you define, such as `ORDER:INVALID_DATA`, created by mapping or raising.
- **Error mapping**: a per-operation rule that rewrites a source error type into a target custom type.
- **Raise Error** (`<raise-error>`): a core component that throws a Mule error with a chosen type and description.
- **Namespace**: the part before the colon (`HTTP`, `DB`, `MULE`, `ORDER`); it tells you where an error came from.

## Key facts

| Fact | Detail | Source |
|---|---|---|
| Where an error mapping goes | Inside the operation: `<error-mapping sourceType="..." targetType="..."/>` | [Mule Errors](https://docs.mulesoft.com/mule-runtime/latest/mule-error-concept) |
| What mapping solves | The same error from different operations gets different custom types | [Mule Errors](https://docs.mulesoft.com/mule-runtime/latest/mule-error-concept) |
| Raise Error fields | `type` (string) and `description` (string or DataWeave) | [Raise Error Component](https://docs.mulesoft.com/mule-runtime/latest/raise-error-component-reference) |
| Raise Error allowed types | Core runtime types and custom types only | [Raise Error Component](https://docs.mulesoft.com/mule-runtime/latest/raise-error-component-reference) |
| Core runtime type raised | Only the description can be customised | [Raise Error Component](https://docs.mulesoft.com/mule-runtime/latest/raise-error-component-reference) |
| Connector namespaces | Cannot be used by Raise Error or for custom types | [Raise Error Component](https://docs.mulesoft.com/mule-runtime/latest/raise-error-component-reference) |
| Declaring a namespace | Using it in a `raise-error` declares it for other components | [Raise Error Component](https://docs.mulesoft.com/mule-runtime/latest/raise-error-component-reference) |
| Type with no namespace | Implicit `MULE`: `EXPRESSION` = `MULE:EXPRESSION` | [Mule Errors](https://docs.mulesoft.com/mule-runtime/latest/mule-error-concept) |
| Reading the error | `error.description` for text, `error.errorType` for the type | [Mule Errors](https://docs.mulesoft.com/mule-runtime/latest/mule-error-concept) |

## Check yourself

- What does Mule raise when a Choice router compares a missing query parameter against a number?
- When can a custom namespace first used in one `raise-error` be used again?
- Why does the `description` field of Raise Error accept a DataWeave expression?
- Why would a handler read `error.errorType` rather than `error.description` to decide how to respond?

## Sources

- [Mule Errors](https://docs.mulesoft.com/mule-runtime/latest/mule-error-concept)
- [Raise Error Component](https://docs.mulesoft.com/mule-runtime/latest/raise-error-component-reference)
- [On-Error Components](https://docs.mulesoft.com/mule-runtime/latest/on-error-scope-concept)
- [Error Handlers](https://docs.mulesoft.com/mule-runtime/latest/error-handling)
- [Configure HTTP Listener Source](https://docs.mulesoft.com/http-connector/latest/http-listener-ref)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 4 linked practice questions, and unlimited timed mock exams are included with the MuleSoft Developer pack (USD $19): https://www.certifyforce.com/practice-exams
