use of org.mule.runtime.core.api.message.ExceptionPayload in project mule by mulesoft.
the class AbstractSystemExceptionStrategy method handleException.
@Override
public void handleException(Exception ex, RollbackSourceCallback rollbackMethod) {
fireNotification(ex, getCurrentEvent());
resolveAndLogException(ex);
logger.debug("Rolling back transaction");
rollback(ex, rollbackMethod);
ExceptionPayload exceptionPayload = new DefaultExceptionPayload(ex);
if (getCurrentEvent() != null) {
PrivilegedEvent currentEvent = getCurrentEvent();
currentEvent = PrivilegedEvent.builder(currentEvent).message(InternalMessage.builder(currentEvent.getMessage()).exceptionPayload(exceptionPayload).build()).build();
setCurrentEvent(currentEvent);
}
if (ex instanceof ConnectException) {
((ConnectException) ex).handleReconnection(retryScheduler);
}
}
use of org.mule.runtime.core.api.message.ExceptionPayload in project mule by mulesoft.
the class TestLegacyMessageUtils method getExceptionPayload.
/**
* If an error occurred during the processing of this message this will return a ErrorPayload that contains the root exception
* and Mule error code, plus any other related info
*
* @param message message used to obtain the data from. Must be a {@link InternalMessage}
* @return The exception payload (if any) attached to this message
* @throws {@link IllegalStateException} if there is any problem accessing the legacy message API using reflection
*/
public static ExceptionPayload getExceptionPayload(Message message) {
try {
Method method = message.getClass().getMethod("getExceptionPayload");
method.setAccessible(true);
return (ExceptionPayload) method.invoke(message);
} catch (Exception e) {
throw new IllegalStateException(LEGACY_MESSAGE_API_ERROR, e);
}
}
Aggregations