从 dataweave 中的 Error ErrorType 读取值

问题描述

需要小的帮助才能根据附加的屏幕截图检索 error.errorType 中的值。

我需要 error.errorType 中的 asstring、标识符和命名空间的值。

并且需要dataweave表达式代码在Mulesoft中写入转换消息。

enter image description here

解决方法

你可以用 .(dot) 符号来引用这些,这应该对你有用吗?

脚本

%dw 2.0
output application/json
---
{
    errorAsString: error.errorType.asString,errorIdentifier: error.errorType.identifier,errorNamespace: error.errorType.namespace
}

从我为演示这一点而创建的示例应用中为您截取了屏幕截图。

enter image description here