How Default Error Handling in Mule 4 works?

Default Error Handling in Mule 4









Default error handling is invoked when there are no error handlers like Global error handler or Custom error handler defined in the Flow. When an error occurs, the Default error handler acts as On Error Propagate component which usually stops the further flow execution. This default error handler then responds to the client with an error description. This error description is fetched from the message processor (Ex: Listener, Request, Is number, Raise error etc..)

Imagine an error handler is not configured, then the default Mule 4 error handler takes care of exception handling. Here you have no option to configure your own things. It is always advised to configure an error handling block in projects to best deliver the responses to calling systems

Scenario:


Consider the below flow where Is number is validating the payload to be an Integer. The actual payload which was sent is not an Integer. As no error handler is configured, Default Error handler handles the exception.

Scenario: How On Error Propagate works in Mule 4?



How it works?



Response:



Since there is no error handler configured the same error description is sent to the calling system.

Status code: 500 Server Error

Response message: Validate payload is an Integer


Scenario: How On Error Continue works in Mule 4?

Post a Comment

0 Comments