0

enter image description hereI have to define a global exception handler and for each flow I have to define the same set of exceptions I want to use global exception handling in Mule 4 , I am following below steps , please suggest/help to configure exception handling globally .

  1. Under Global Configuration Elements ->I clicked on "Click Create Configuration"

2 .I defined default Error Handler in it .

Please find enclosed the screenshot for it .

Thanks

Developer
  • 21
  • 1
  • 7

1 Answers1

1

You can share an error handler in the XML view. Just add a ref attribute to the error-handler attribute pointing to the name of the global error handler.

Note that it is also better to use the XML to share. Flow logic is not clear with just screenshots.

Example:

<flow name="myFlow1">
    ...
    <error-handler ref="Error_Handler">
    </error-handler>
</flow>

<flow name="myFlow2">
    ...
    <error-handler ref="Error_Handler">
    </error-handler>
</flow>    

<error-handler name="Error_Handler">
    <on-error-propagate type="ANY"> 
        <logger level="ERROR" doc:name="Log the error" message="An error happened!" />
    </on-error-propagate>   
</error-handler>
aled
  • 21,330
  • 3
  • 27
  • 34