This document discusses defining global exception strategies in Mule applications. It provides an example Mule flow that references a global catch exception strategy, which sets a 400 status code and error payload when exceptions occur. The example shows log output for valid and invalid token inputs, with the invalid input triggering the global exception strategy. References are provided to the Mule documentation on error handling.
7. • Output:
• If the input is valid input:
• INFO 2016-12-23 09:50:35,930
[[ExceptionHandling].HTTP_Listener_Configuratio
n.worker.01]
org.mule.api.processor.LoggerMessageProcessor:
-Flow started
• INFO 2016-12-23 09:50:35,978
[[ExceptionHandling].HTTP_Listener_Configuratio
n.worker.01]
org.mule.api.processor.LoggerMessageProcessor:
--Token value: ----a1b2c3d4
8.
9. • If the input is invalid input:
• NFO 2016-12-23 09:51:25,543 [[ExceptionHandling].HTTP_Listener_Configuration.worker.01]
org.mule.api.processor.LoggerMessageProcessor: -Flow started
• ERROR 2016-12-23 09:51:25,552 [[ExceptionHandling].HTTP_Listener_Configuration.worker.01]
org.mule.exception.CatchMessagingExceptionStrategy:
• ********************************************************************************
• Message : Execution of the expression
"message.inboundProperties.'http.query.params'.token.toString()" failed.
(org.mule.api.expression.ExpressionRuntimeException).
• Payload : {NullPayload}
• Element XML : <set-property propertyName="token"
value="#[message.inboundProperties.'http.query.params'.token.toString()]"
doc:name="Property"></set-property>
• Payload Type : org.mule.transport.NullPayload
• Element : /ExceptionHandlingFlow/processors/1 @
ExceptionHandling:ExceptionHandling.xml:13 (Property)
• --------------------------------------------------------------------------------
• Root Exception stack trace:
• java.lang.NullPointerException
• at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
• at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
• at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)