How Global Error Handler works in Mule 4?

How Global Error Handler works in Mule 4?



To handle the errors at the application level, the Global Error Handler is configured. We also call it a Shared/Common Error handler. We have created a scenario where there is no error handling configured in the flow level but a Global Error handler is created.

Scenario 1: Using On Error Propagate


The main flow throws an exception and no error handler is configured. What happens in such a scenario when On Error Propagate is configured in Global Error Handler

How it works?




Response:
The response in this scenario is the actual error object that the Main flow has generated.

Status code: 500 Server Error

Response message: Payload is not an Integer


Scenario 2: Using On Error Continue


The main flow throws an exception and no error handler is configured. What happens in such a scenario when On Error Continue is configured in Global Error Handler


How it works?



Response:


As expected, The payload message configured in On Error Continue is sent to the client

Status code: 200 OK

Response message: Global error handler response



Post a Comment

0 Comments