0

如果我的默认异常策略中有以下块,我该如何返回错误消息的实际文本。

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

日志中的示例错误消息

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

2 回答 2

0

你试过了吗:

evaluator="groovy" expression="payload.exception.message"

?

于 2013-01-10T18:04:29.663 回答
0

这对我有用。

<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>
于 2013-01-15T20:50:15.000 回答