Introduction to Processor Level Error Handling in Anypoint Platform(Mule 4) Part-1

Handling Errors at Processor Level

For more fine-grain error handling of elements within a flow, processor level error handling is used. A “Try” scope is used for the same. Any number of processors can be added to a Try scope. The Try scope has its own error handling section to which one or more error scopes can be added.

Error handling scenario 7

A calling flow has an on error propagation scope and a Try scope. Try scope also has an on error propagation scope. In try scope, the error occurs at processor labeled as E, and subsequent processors are not executed.

<?xml version="1.0" encoding="UTF-8"?><mule xmlns:validation=""xmlns:http="" xmlns=""xmlns:doc=""xmlns:xsi="" xsi:schemaLocation=""><flow name="scenario-7Flow" doc:id="599ae7d9-76ae-422b-a0a4-d3ba949074cb" ><http:listener doc:name="Listener" doc:id="d12ca8dd-0209-4616-9391-0c691c6b005b" config-ref="HTTP_Listener_config" path="/base7"/><set-payload value='"Max Mule"' doc:name='Payload = "Max Mule"' doc:id="b62a73ef-25e0-474e-a97c-c7a9a5eb8372" /><try doc:name="Try" doc:id="1b2f69aa-e5b8-4842-b6a0-59749672290e" ><validation:is-null doc:name="Is null" doc:id="e20315e4-a784-43c2-85b9-6eefac08b849" value='#["Payload is not null"]'/><set-payload doc:name='payload = "modified try payload"' doc:id="390a14a4-e735-4863-abc1-9eb5002eac0e" value='"modified try  payload"'/><logger level="INFO" doc:name="Logger" doc:id="a7379fe6-7868-4ae7-9910-d02908dd2268" message="#[payload]"/><error-handler ><on-error-propagate enableNotifications="true" logException="true" doc:name="On Error Propagate" doc:id="3c9bab6b-67d7-4cf7-bd68-55b394c4961f" ><set-payload value="On error propagate - try scope" doc:name='Payload = "On error propagate - try scope"' doc:id="8706db03-03bf-4b19-8d49-1718e55f041f" /><logger level="INFO" doc:name="Logger" doc:id="d8c34783-8d52-4497-b0bf-1192d231fef8" /></on-error-propagate></error-handler></try><set-payload doc:name='payload = "modified payload"' doc:id="3110897b-fb01-4740-9134-4971ab9c1a7a" value='"modified payload"'/><logger level="INFO" doc:name="Logger" doc:id="5e1048e3-a298-4975-be5f-fbfb912ab626" message="#[payload]"/><error-handler ><on-error-propagate enableNotifications="true" logException="true" doc:name="On Error Propagate" doc:id="938a157e-ee2a-4c9c-ab4d-b8571d0f8f53" ><set-payload value="On error propagate- parent flow" doc:name='Payload = "On error propagate - parent flow"' doc:id="70efff90-c047-4c9c-bed8-787968a7a3a3" /><logger level="INFO" doc:name="Logger" doc:id="be3bfb8f-8516-4476-a524-54c11e349d94" /></on-error-propagate></error-handler></flow></mule>



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store