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.
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