A calling flow has an on error continue scope and a Try scope. Try scope has an on error propagate scope. In try scope, the error occurs at processor labeled as E, and subsequent processors are not executed.
As the flow is executing and the error occurs at the processor E, the error is thrown to the On Error Propagate scope of Try scope. After the last processor from this error scope is executed, the Try scope’s subsequent processors are not executed, and the Mule event is returned to calling flow with the error object. Now calling flow also throws an error, which is handled by its On Error Continue scope. After the last processor from this error scope is executed, the calling scope’s subsequent processors are not executed, and a success message is returned with payload to the HTTP listener.
Debug the application to understand how the error is handled.
Once your application is successfully deployed, Go to Postman or Advance rest-client and send a request to the API. As seen in the exhibit below, the payload is not set yet.
In another step, the payload is set to “Max Mule” and it will be on Try scope. (exhibit below)
When taken another step, it will start executing processors in Try scope. (exhibit below)
In another step, Is null validation component will throw an error. (exhibit below)
This error is now handled by an On Error Propagation scope of the Try scope. (exhibit below)
in another step, the processor inside this error scope will modify the payload (exhibit below)
In the next step, as the Error scope is complete, the remaining processors of the try scope are not executed, and the Mule event is returned to the calling flow with an error response. (exhibit below)
As the calling flow has an error, the Mule event is passed to the On Error Continue scope of the parent flow. (exhibit below)
In another step, the processor inside this error scope will modify the payload (exhibit below)
In the next step, as the Error scope is complete, the remaining processors of the parent flow are not executed, and the payload is returned to the HTTP listener without any error message, which can be seen in the Postman(exhibit below)
Error handling scenario 3
A calling flow has an on error continue or propagate scope and a Try scope. Try scope has an on error continue scope. In try scope, the error occurs at processor labeled as E, and subsequent processors are not executed.
As the flow is executing and the error occurs at the processor E, the error is thrown to the On Error continue scope of Try scope. After the last processor from this error scope is executed, the Try scope’s subsequent processors are not executed, and the Mule event is returned to calling flow without the error object. Now, calling flow does not throw an error; hence, the calling scope’s subsequent processors are executed, and a success message is returned with payload to the HTTP listener.
Debug the application to understand how the error is handled.
Once your application is successfully deployed, Go to Postman or Advance rest-client and send a request to the API. As seen in the exhibit below, the payload is not set yet.
In another step, the payload is set to “Max Mule” and it will be on Try scope. (exhibit below)
When taken another step, it will start executing processors in Try scope. (exhibit below)
In another step, Is null validation component will throw an error. (exhibit below)
This error is now handled by an On Error Continue scope of the Try scope. (exhibit below)
in another step, the processor inside this error scope will modify the payload (exhibit below)
In the next step, as the Error scope is complete, the remaining processors of the try scope are not executed, and the Mule event is returned to the calling flow without an error response. As the calling flow does not have an error, the Mule event is passed to the calling flow’s next processors. (exhibit below)
in another step, the set payload processor of the calling flow will modify the payload (exhibit below)
In the next step, as the calling flow is complete, the payload is returned to the HTTP listener without any error message, which can be seen in the Postman(exhibit below)