Reputation: 702
In Mule I'm using a catch exception strategy referenced by a "complex" flow.
I put a jdbc component in the exception strategy, to update a table record in case of error
How can I access the exception stack trace to log it on this table?
I checked the payload at the beginning of the exception strategy and it is of type org.apache.commons.httpclient.methods.PostMethod
in fact I got the error during an http call.
Upvotes: 1
Views: 2589
Reputation: 6647
In the exception strategy exception is not available in the Payload. It is available in the exceptionPayload variable of the Message object.
Use
Exception exception = (Exception)message.getExceptionPayload().getException();
This give ExceptionPaylaod object whose getException() method provides the exception object.
To get the stack trace use the following.
StackTraceElement[] ste = exception.getCause().getStackTrace();
From there you can continue as your need.
Hope this helps.
Upvotes: 3