18.18Scenario 17 — Error-to-HTTP mapping
A clean conceptual design:
APP:INVALID_CUSTOMER
→ 400
APP:CUSTOMER_NOT_FOUND
→ 404
SALESFORCE:CONNECTIVITY
→ 503
ANY
→ 500
You might use:
vars.httpStatus
and set a normalized response:
%dw 2.0
output application/json
---
{
code: "CUSTOMER_SERVICE_UNAVAILABLE",
message: "Customer service is temporarily unavailable",
correlationId: correlationId
}
Do not expose raw connector internals unnecessarily.