Skip to main content

Hello all,

 

I am throwing not found exception from one the flow in groovy script as below -

throw new org.mule.module.apikit.exception.NotFoundException("id "+ flowVars.id+ " not found");

 

It throws exception and caught by exception strategy but when I try to print exception message it prints exception message along with exception type as below

{

"message": "org.mule.module.apikit.exception.NotFoundException: Id 1234 not found"

}

 

i want to get rid of this exception type from exception message. I am using '# [exception.cause.message]' to print above message.

1 resposta
  1. 18 de jan. de 2018, 17:28

    Hi

    You can try groovy scripting transformer.

     

    <scripting:transformer doc:name="Groovy">

    <scripting:script engine="Groovy"><![CDATA[return message.getExceptionPayload().getRootException().getMessage()

    ] ]></scripting:script>

     

    HTH

0/9000