【发布时间】:2021-05-19 11:35:15
【问题描述】:
我有一个 DataWeave 消息转换器,比如说:
%dw 2.0
import fail from dw::Runtime
output application/java
fun isValuePresent(value, message: String) = if ( value == null or isEmpty(value) ) fail(message) else value
---
{
brand: isValuePresent(payload.document[0].brand, p('import.error.missing.brand')),
...
我也有此类错误的错误处理程序。
Mule 中的错误有其属性,例如:description 或 detailedDescription。
现在通常,当我发现其他错误(例如来自 is true 组件的错误)时 - 一切都很好,error.description 保存我的错误消息,一切都很好。
但是当产生fail() 产生的错误时,我得到一个非常大的错误描述信息:
""my error message here
Trace:
at fail (Unknown)
at isValuePresent (line: 13, column: 85)
at main (line: 23, column: 7)" evaluating expression: "%dw 2.0
import fail from dw::Runtime
output application/java
fun isValuePresent(value, message: String) = if ( value == null or isEmpty(value) ) fail(message) else value
---
{
brand: isValuePresent(payload.document[0].brand, p('import.error.missing.brand')),
...
...
etc, etc
看起来我的 dataweave 脚本的全部内容都添加到了跟踪中。我只想拥有:
my error message here
Trace:
at fail (Unknown)
at isValuePresent (line: 13, column: 85)
at main (line: 23, column: 7)" evaluating expression: "%dw 2.0
有可能实现吗?或者我在设计这种行为时犯了一些错误?有没有办法解决这个问题?
【问题讨论】:
-
能否请您包含 DataWeave 脚本?谢谢。
标签: mule mule-studio dataweave mule-esb