Search code examples
error-handlingmulemule-studiomule-esb

Why in mulesoft "on Error Propagate" rethrows the same error?


I am new to mulesoft and while studing it i strugle to understand why on module "onErrorPropagate" the error is being rethrown after executing the scope.

can you explain the benefits?


Solution

  • The "onErrorPropagate" propagates (rethrows) the error to the parent flow (or the global error handler if it's already reached the main flow).

    This can be usefull in a few cases. Say you have some flow specific error handling (e.g. if something goes wrong, set a default payload). Then you propagate this error to the next level where you have your Global error handler that, say, stores some info in a QA database.

    You don't want to have that database connector in every single error handler. In this way you can achieve a 'java inherritance' like structure, for your errors.

    Side note: if you want your error to only be handled and do nothing further, you can use "onErrorContinue"