18.15Scenario 14 — Raise custom business error
Prompt:
“Reject customers missing customerId.”
Conceptually:
<choice>
<when expression="#[payload.customerId == null]">
<raise-error
type="APP:INVALID_CUSTOMER"
description="customerId is required"/>
</when>
</choice>
You can also use Mule Validation components.
The point is:
business/domain error
→ APP:INVALID_CUSTOMER
rather than leaking a random Java exception.