Skip to content

Instantly share code, notes, and snippets.

@javaduke
Created February 13, 2014 15:33
Show Gist options
  • Save javaduke/8977245 to your computer and use it in GitHub Desktop.
Save javaduke/8977245 to your computer and use it in GitHub Desktop.
<apikit:mapping-exception-strategy name="acme-apiKitGlobalExceptionMapping">
<apikit:mapping statusCode="404">
<apikit:exception value="org.mule.module.apikit.exception.NotFoundException" />
<set-property propertyName="Content-Type" value="application/json" />
<set-payload value="{ &quot;message&quot;: &quot;Resource not found&quot; }" />
</apikit:mapping>
<apikit:mapping statusCode="405">
<apikit:exception value="org.mule.module.apikit.exception.MethodNotAllowedException" />
<set-property propertyName="Content-Type" value="application/json" />
<set-payload value="{ &quot;message&quot;: &quot;Method not allowed&quot; }" />
</apikit:mapping>
<apikit:mapping statusCode="415">
<apikit:exception value="org.mule.module.apikit.exception.UnsupportedMediaTypeException" />
<set-property propertyName="Content-Type" value="application/json" />
<set-payload value="{ &quot;message&quot;: &quot;Unsupported media type&quot; }" />
</apikit:mapping>
<apikit:mapping statusCode="406">
<apikit:exception value="org.mule.module.apikit.exception.NotAcceptableException" />
<set-property propertyName="Content-Type" value="application/json" />
<set-payload value="{ &quot;message&quot;: &quot;Not acceptable&quot; }" />
</apikit:mapping>
<apikit:mapping statusCode="400">
<apikit:exception value="org.mule.module.apikit.exception.BadRequestException" />
<set-property propertyName="Content-Type" value="application/json" />
<set-payload value="{ &quot;message&quot;: &quot;Bad request&quot; }" />
</apikit:mapping>
</apikit:mapping-exception-strategy>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment