If I have the following block in my default-exception-strategy how do I return the actual text of the error message.
<when evaluator="groovy" expression='payload.getException() instanceof org.mule.api.expression.RequiredValueException'>
<expression-transformer evaluator="groovy" expression="payload.getPayload()"/>
<smtp:outbound-endpoint ref="errorSmtpEPRequiredValueException" doc:name="emailError"/>
</when>
sample error message in logs
[01-10 16:49:27] ERROR DefaultMessagingExceptionStrategy [[inventorymgtetl].processPay.stage1.03]: Caught exception in Exception Strategy:
Expression Evaluator "header" with expression "session:pay_totalAmmount" returned null but a value was required.
org.mule.api.expression.RequiredValueException: Expression Evaluator "header" with expression "session:pay_totalAmmount" returned null but a value was required.
This is what worked for me people.
<message-properties-transformer scope="session" doc:name="save values to session">
<add-message-property key="err_exception" value="#[groovy:payload.getException().toString()]"/>
<add-message-property key="err_clause" value="#[groovy:payload.getException().getCause().toString()]"/>
</message-properties-transformer>