Contact Free trial Login

About Handling Errors

APIkit 4.0 replaces exception strategy and error mapping with the Mule Runtime 4.0 error handler. This error handler uses error types as shown in the code snippet below. Each error response is generated using DataWeave.

<apikit:router config-ref="api-config" />
<error-handler>
    <on-error-propagate type="APIKIT:BAD_REQUEST">
        <ee:transform xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
            <ee:message>
                <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{message: "Bad request"}]]></ee:set-payload>
            </ee:message>
            <ee:variables>
                <ee:set-variable variableName="httpStatus">400</ee:set-variable>
            </ee:variables>
        </ee:transform>
    </on-error-propagate>
</error-handler>

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.