Called when an exception occurred. Fires the ErrorOccured event.
@param exception The exception that was thrown by the TransformationSink.
509150
protected void onTransformationSinkErrorOccurred(Exception exception) {

        for (TransformerSinkEventListener listener : transformerSinkEventListeners)
            fireErrorEvent(listener, new TransformerSinkErrorEvent(this, exception));
    }


    /**
     * (Re)-fires a preconstructed event.
     * @param event The event to fire
     */
    protected void onTransformationSinkErrorOccurred(TransformerSinkErrorEvent event) {

        for (TransformerSinkEventListener listener : transformerSinkEventListeners)
            fireErrorEvent(listener, event);
    }

    /**
     * Fires the given event on the given listener.
     * @param listener The listener to fire the event to.
     * @param event The event to fire.
     */
    private void fireErrorEvent(TransformerSinkEventListener listener, TransformerSinkErrorEvent event) {

        try {
            listener.ErrorOccurred(event);
        }
        catch (RuntimeException e) {
            // Log this somehow
            System.err.println("Exception thrown while trying to invoke event listener, removing bed behaved listener.");
            e.printStackTrace();
            removeTransformerSinkEventListener(listener);
        }
    }
}
629801
public void         takeException(Exception exception) throws Exception
    {
        boolean     rethrow = true;
        if ( isRetryException(exception) )
        {
            if ( !Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES) )
            {
                log.debug("Retry-able exception received", exception);
            }

            if ( retryPolicy.allowRetry(retryCount++, System.currentTimeMillis() - startTimeMs, sleeper) )
            {
                new EventTrace("retries-allowed", tracer.get()).commit();
                if ( !Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES) )
                {
                    log.debug("Retrying operation");
                }
                rethrow = false;
            }
            else
            {
                new EventTrace("retries-disallowed", tracer.get()).commit();
                if ( !Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES) )
                {
                    log.debug("Retry policy not allowing retry");
                }
            }
        }

        if ( rethrow )
        {
            throw exception;
        }
    }
630418
public static void rethrowException(Throwable t) throws Exception {
		if (t instanceof Error) {
			throw (Error) t;
		}
		else if (t instanceof Exception) {
			throw (Exception) t;
		}
		else {
			throw new Exception(t.getMessage(), t);
		}
	}
455586
public void log(Throwable exception) {
		if (exception instanceof CoreException) {
			getILog().log(new Status(IStatus.ERROR, PLUGIN_ID,
					exception.getMessage(),
					exception.getCause()));
		} else if (exception != null) {
			getILog().log(new Status(IStatus.ERROR, PLUGIN_ID,
					exception.getMessage(), exception));
		} else {
			getILog().log(new Status(IStatus.ERROR, PLUGIN_ID,
					"Internal Error", exception));   //$NON-NLS-1$
		}
	}
1023648
protected void registerLoggedException(Throwable exception) {
		SpringBootExceptionHandler handler = getSpringBootExceptionHandler();
		if (handler != null) {
			handler.registerLoggedException(exception);
		}
	}
822326
public void requestFailed (Exception cause)
    {
        if (cause instanceof InvocationException) {
            _listener.requestFailed(cause.getMessage());
        } else {
            log.warning(cause);
            _listener.requestFailed(InvocationCodes.INTERNAL_ERROR);
        }
    }
329020
public void dispatch(Event<?> event) {
		//eventManagement.dispatch(event);
		for (EventListener listener : KReflection.Holder.INSTANCE.listeners) {
			try {
				listener.handleEvent(event);
			} catch (Exception e) {
				// ignore
				// TODO add message kind
			}
		}
	}
270549
public org.glassfish.jersey.server.monitoring.RequestEvent.ExceptionCause getExceptionCause() {
        return event.getExceptionCause();
    }
373358
private void logError(LifecycleListener listener, Exception e) {
        LOGGER.error("Error for listener " + listener.getClass(), e);
    }
844169
@SuppressWarnings("checkstyle:regexp")
	public static void showError(String message, Throwable exception) {
		try (PrintWriter logger = new PrintWriter(getConsoleLogger())) {
			if (message != null && !message.isEmpty()) {
				logger.println(message);
			} else if (exception != null) {
				exception.printStackTrace(logger);
			}
			logger.println();
			logger.flush();
			showHelp(logger, false);
			showVersion(true);
		}
	}
376923
public void log(Throwable exception) {
		if (exception instanceof CoreException) {
			getILog().log(new Status(IStatus.ERROR, PLUGIN_ID,
					exception.getMessage(), exception.getCause()));
		} else if (exception != null) {
			getILog().log(new Status(IStatus.ERROR, PLUGIN_ID,
					MessageFormat.format(Messages.SARLMavenEclipsePlugin_0, exception.getMessage()), exception));
		} else {
			getILog().log(new Status(IStatus.ERROR, PLUGIN_ID,
					"Internal Error", exception));   //$NON-NLS-1$
		}
	}
686945
public void setErrorListener(ErrorListener listener) throws IllegalArgumentException
  {
    if (listener == null) 
      throw new IllegalArgumentException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, null)); //"Null error handler");
    m_errorListener = listener;
  }
730610
protected void fireEvent(E event) {

    for (L listener : this.listeners) {
      try {
        fireEvent(event, listener);
      } catch (RuntimeException e) {
        handleListenerError(listener, event, e);
      }
    }
  }
1007693
@Override
    public void dispatch(@Nonnull final NessEvent event)
    {
        if (event == null) {
            LOG.trace("Dropping null event");
        }
        else {

            for (final NessEventReceiver receiver : eventReceivers) {
                try {
                    if (receiver.accept(event)) {
                        receiver.receive(event);
                    }
                } catch (Exception e) {
                    // don't reraise. We prefer to not disrupt event handling by other receievers
                    LOG.error(e, "Exception during event handling by %s of event %s", receiver, event);
                }
            }
        }
    }
21141
public void requestFailed (Exception cause)
    {
        _error = cause;
        ResultListener<T> list = _list;
        _list = null;

        list.requestFailed(cause);
    }
227115
@Override
    public void onEvent(Object event, long sequence, boolean endOfBatch) throws Exception {
        if (event == null) {
            return;
        }
        handleEvent(event, endOfBatch);
    }
276464
protected void handleAdapterInvocationError(Throwable errorCause)
        throws ActivityException {
        logger.severeException(getAdapterInvocationErrorMessage(), errorCause);
        boolean isErrorRetryable;
        int errorCode;
        if (errorCause instanceof AdapterException) {
            AdapterException adEx = (AdapterException) errorCause;
            isErrorRetryable = adEx.isRetryable();
            if (adEx.getCode() != 0) {
                errorCode = adEx.getCode();
            }
            else {
                errorCode = ServiceException.INTERNAL_ERROR;
            }
        }
        else if (errorCause instanceof ConnectionException) {
            errorCode = ((ConnectionException)errorCause).getCode();
            // if process is invoked sync style, no need to retry due to connection failure
            Process procVO = getProcessDefinition();
            if (procVO.getProcessType().equals(ProcessVisibilityConstant.SERVICE)) {
                super.setReturnCode("ERROR:");
                return;
            }
            isErrorRetryable = true;
        }
        else {
            errorCode = ServiceException.INTERNAL_ERROR;
            isErrorRetryable = false;
        }

        if (isErrorRetryable) {
            super.setReturnCode(ActivityResultCodeConstant.RESULT_RETRY);
        }

        this.handleAdapterFailure(errorCode, errorCause);
    }