Ram Bavireddi
Ram Bavireddi

Reputation: 1187

Throw custom exception from catch-exception-strategy

Is it possible to throw our own custom exception from catch-exception-strategy or any other exception strategies.

I tried like below:

<catch-exception-strategy doc:name="Catch Exception Strategy">
  <scripting:component doc:name="throw-custom-exception">
    <scripting:script engine="Groovy">
      <![CDATA[throw new org.mycompany.mule.CustomException()]]>
    </scripting:script>
   </scripting:component> 
</catch-exception-strategy>

but ended up with the error:

org.mule.exception.CatchMessagingExceptionStrategy: Failed to dispatch message to error queue after it failed to process

Can anyone solve this? Thanks in advance.

Upvotes: 3

Views: 2121

Answers (1)

Anirban Sen Chowdhary
Anirban Sen Chowdhary

Reputation: 8311

Try to put the

<scripting:component doc:name="throw-custom-exception">
    <scripting:script engine="Groovy">
      <![CDATA[throw new org.mycompany.mule.CustomException()]]>
    </scripting:script>
   </scripting:component> 

outside catch-exception-strategy and try...

Upvotes: 1

Related Questions