Handling Errors8% of the exam

Global and default error handlers

How Mule 4 handles a messaging error when nothing is configured, how to define a named global Error Handler and attach it with error-handler ref or the defaultErrorHandler-ref global configuration, and how to reuse a single named On-Error component with on-error ref.

Official exam objective
Apply correct processors/syntax to implement global error handlers, and predict outcomes.

~7 min read · 5 practice questions ·

What the exam expects

  • Predict what a caller receives when a flow fails and no error handling is configured (the default handling).
  • Write the XML that defines a named global Error Handler and attaches it to chosen flows with <error-handler ref="..."/>.
  • Make one global Error Handler the application default with a <configuration defaultErrorHandler-ref="..."/> global element, and predict which handler runs when a flow also declares its own.
  • Reuse one named On-Error component inside several Error Handlers with <on-error ref="..."/>.
  • Reject configurations that do nothing: a handler that is defined but never referenced, a handler called with Flow Reference, or a handler put in a subflow.

Key terms:

  • Error Handler (<error-handler>): the container that routes an error to the first matching On-Error component; built into every flow and Try scope, or defined globally with a name.
  • Global Error Handler: an <error-handler name="..."> defined at the root of a configuration file, outside any flow.
  • Default error handler: the handler named by defaultErrorHandler-ref on the <configuration> global element.
  • On-Error component: On Error Continue or On Error Propagate, the scopes that hold the processors that run for a matched error.

Key facts

Unhandled messaging error
Detail
Logged and propagated by the default handler (OnErrorPropagateHandler)
HTTP Listener default responses
Detail
Success: 200 with the payload; failure: 500 with the error description
Reference a global handler from a flow
Detail
<error-handler ref="name"/> inside the flow (XML-only)
Set the app default
Detail
<configuration defaultErrorHandler-ref="name"/>; optional, default none
What defaultErrorHandler-ref may point at
Detail
Must be a reference to a global error handler
Studio path for the default
Detail
Global Elements > Create > Global Configuration > Configuration > Default Error Handler
Reuse one On-Error component
Detail
<on-error ref="name"/> inside an <error-handler>
Who can reference a global handler
Detail
Flows and Try scopes
Subflows
Detail
No built-in error handling; use a Try scope inside
Flow handler versus default
Detail
Exam convention: a flow's own handler wins; the default is for flows with none
Sources for this section (5)
  • What does a client calling an HTTP Listener flow receive when the flow fails and no error handling is configured?
  • Why does the Studio console show an OnErrorPropagateHandler entry for a flow that has no Error Handler at all?
  • What may defaultErrorHandler-ref point at, and what is its default?
  • Why can no global or flow-level On-Error component handle an error of the CRITICAL type?

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 (5 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