Search code examples
mulemule-studiodataweavemule-el

Accessing Error Detail in Console


Using Mule 4.1

When an error is encountered in a flow something like the following is logged in the console.

********************************************************************************
Message : Cannot parse input XML because it is invalid.
Error type : XML-MODULE:INVALID_INPUT_XML
Element : LogError/processors/0/processors/0 @ systemadapter:systemadapter.xml:29 (Validate schema)
Element XML : (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) ********************************************************************************

I know how to access the Message and the Error Type. How do I get the Element or Element XML? I've used the below Data-weave to to get the error information. However, I cannot seem to find any thing that will tell the Element. My over all goal would be to find which component in the flow generated the error.

%dw 2.0
output application/json
---
{
    "message" : error.exception.message,
    "detailMessage" : error.exception.detailMessage,
    "identifier" : error.errorType.identifier,
    "namespace" : error.errorType.namespace,
    "detailedDescription" : error.detailedDescription,
    "causeMessage" : error.exception.cause.message,
    "causeDetailMessage" : error.exception.cause.detailMessage,
    "backtrace" : error.exception.cause.backtrace

}

Solution

  • With some help from the MuleSoft support team I was able to access the detail using #[message.message.exceptionPayload.info] This returns an array of objects that are presented in the console. So, my Dataweve needs to look like the following. I've only verified this in Mule 4.1.2 and 4.1.3.

    %dw 2.0 output application/json
    --- {
        "message" : error.exception.message,
        "detailMessage" : error.exception.detailMessage,
        "element" : message.message.exceptionPayload.info['Element'],
        "elementXML" : message.message.exceptionPayload.info['Element XML']
    }