Handling Errors8% of the exam

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.

Official exam objective
Apply correct processors/syntax to map custom errors, and predict outcomes.

~7 min read · 4 practice questions ·

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

Where an error mapping goes
Detail
Inside the operation: <error-mapping sourceType="..." targetType="..."/>
What mapping solves
Detail
The same error from different operations gets different custom types
Raise Error fields
Detail
type (string) and description (string or DataWeave)
Raise Error allowed types
Detail
Core runtime types and custom types only
Core runtime type raised
Detail
Only the description can be customised
Connector namespaces
Detail
Cannot be used by Raise Error or for custom types
Declaring a namespace
Detail
Using it in a raise-error declares it for other components
Type with no namespace
Detail
Implicit MULE: EXPRESSION = MULE:EXPRESSION
Reading the error
Detail
error.description for text, error.errorType for the type
Sources for this section (2)
  • 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?

The questions are free to read. Answers with their sources and self-grading are included with the pack.

Keep reading with the MuleSoft Developer pack

  • Core concepts
  • Exam traps
  • Worked scenario

The pack includes:

  • All 40 lessons of the MuleSoft Developer guide, with reading progress
  • Interactive decision walks and step-by-step sequence steppers
  • Practice exams purchase adds inline bank questions and topic practice (4 questions for this lesson)
  • An official source cited for every claim
  • An AI tutor that answers from the guide
  • Unlimited timed practice exams

Practice for the MuleSoft Developer exam