A Look into Error Handling in Mule 4 Beta

error handling mule 4 beta

If you ever used Mule 3, then there are probably two things about error handling you already know:

  1. It’s really Java exception handling
  2. It’s a “trial and error” experience

In this post, I’ll explain the major changes introduced in Mule 4 around error handling, including easier routing and the introduction of our new try scope.

Introducing the Validations Module

This all began with a very popular request: “We want to be able to throw an Exception from a flow”. The motivation for this is that it’s fairly common to run into “business errors” (errors not related to the handling and transmission of data but the data itself) which should actually be treated in the same way as a connection or system error (things like the remote endpoint is down).

Given the popularity of the request we decided to look into it and started by asking: “which are the use cases in which you would throw an exception?”.