Search in sources :

Example 1 with DefaultExceptionPayload

use of org.mule.runtime.core.internal.message.DefaultExceptionPayload 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);
    }
}
Also used : DefaultExceptionPayload(org.mule.runtime.core.internal.message.DefaultExceptionPayload) PrivilegedEvent(org.mule.runtime.core.privileged.event.PrivilegedEvent) DefaultExceptionPayload(org.mule.runtime.core.internal.message.DefaultExceptionPayload) ExceptionPayload(org.mule.runtime.core.api.message.ExceptionPayload) ConnectException(org.mule.runtime.core.api.connector.ConnectException)

Aggregations

ConnectException (org.mule.runtime.core.api.connector.ConnectException)1 ExceptionPayload (org.mule.runtime.core.api.message.ExceptionPayload)1 DefaultExceptionPayload (org.mule.runtime.core.internal.message.DefaultExceptionPayload)1 PrivilegedEvent (org.mule.runtime.core.privileged.event.PrivilegedEvent)1