We have:
output application/json
---
message: error.exception.errorMessage.typedValue
As part of a larger error handling object.
When using schema validation inside the flow and with the returned error:
error.muleMessage.typedValue = TypedValue[value: '[$.fromAddress: is missing but it is required]', dataType: 'SimpleDataType{type=java.lang.String, mimeType='application/json'}']
Error:
org.mule.runtime.core.api.expression.ExpressionRuntimeException: "Unexpected character '$' at typedValue@[1:2] (line:column), expected false or true or null or {...} or [...] or number but was , while reading `typedValue` as Json.
Tried a few things but nothing seemed to work so far. Is there a way to formatting that response such that it does not die on the $ or treats it just as a really messy string?
Hello Michal,
Please find the below answer:
%dw 2.0
//Author Manish Yadav
var error =
exception:
errorMessage:
typedValue: payload //Here I have used payload just to show you that I am treating input mimeType application/json
output application/json
---
message: error.exception.errorMessage.typedValue.^raw
// just use .^raw for solution and reply me back, I replicated exactly same and it is working.
FYI:
Thanks,
Manish Kumar Yadav
Trailblazer Community Forum Ambassadors