public static void doDefault(ErrorEvent event) { Throwable t = event.getThrowable(); if (t instanceof SocketException) { // Most likely client browser closed socket getLogger().info("SocketException in CommunicationManager." + " Most likely client (browser) closed socket."); return; } t = findRelevantThrowable(t); // Finds the original source of the error/exception AbstractComponent component = findAbstractComponent(event); if (component != null) { // Shows the error in AbstractComponent ErrorMessage errorMessage = AbstractErrorMessage .getErrorMessageForException(t); component.setComponentError(errorMessage); } // also print the error on console getLogger().log(Level.SEVERE, "", t); }
/** * Call the session's {@link ErrorHandler}, if it has one, with the given * exception wrapped in an {@link ErrorEvent}. */ private void callErrorHandler(VaadinSession session, Exception e) { try { ErrorHandler errorHandler = ErrorEvent.findErrorHandler(session); if (errorHandler != null) { errorHandler.error(new ErrorEvent(e)); } } catch (Exception ex) { // Let's not allow error handling to cause trouble; log fails getLogger().log(Level.WARNING, "ErrorHandler call failed", ex); } }
public ErrorEvent(Throwable t) { setThrowable(t); }
listenerMethod.receiveEvent(event); } catch (Exception e) { errorHandler.error(new ErrorEvent(e));
/** * Handles an exception related to a connector by invoking the appropriate * error handler. * * @deprecated As of 7.1. See #11411. * * @param throwable * the exception to handle * @param connector * the connector that the exception is related to */ @Deprecated public void handleConnectorRelatedException(ClientConnector connector, Throwable throwable) { ErrorEvent errorEvent = new ConnectorErrorEvent(connector, throwable); ErrorHandler handler = ErrorEvent.findErrorHandler(connector); handler.error(errorEvent); }
private void onVaadinSessionStarted(VaadinRequest request, VaadinSession session) throws ServiceException { SessionInitEvent event = new SessionInitEvent(this, session, request); for (SessionInitListener listener : sessionInitListeners) { try { listener.sessionInit(event); } catch (Exception e) { /* * for now, use the session error handler; in the future, could * have an API for using some other handler for session init and * destroy listeners */ session.getErrorHandler().error(new ErrorEvent(e)); } } ServletPortletHelper.checkUiProviders(session, this); }
.findErrorHandler(UI.this); .findErrorHandler(session);
private static Throwable getRootExceptionFrom(final ErrorEvent event) { return getRootCauseOf(event.getThrowable()); }
/** * Handles exceptions thrown during the execution of this task. * * @since 7.1.8 * @param exception * the thrown exception. */ public void handleError(Exception exception) { try { exception = ErrorHandlingRunnable.processException(runnable, exception); if (exception != null) { ErrorEvent errorEvent = new ErrorEvent(exception); ErrorHandler errorHandler = ErrorEvent .findErrorHandler(session); if (errorHandler == null) { errorHandler = new DefaultErrorHandler(); } errorHandler.error(errorEvent); } } catch (Exception e) { getLogger().log(Level.SEVERE, e.getMessage(), e); } } }
session.getErrorHandler().error(new ErrorEvent(e));
return findErrorHandler(parent); errorHandler = findErrorHandler(ui.getSession()); if (errorHandler != null) { return errorHandler;
@Override public void error(com.vaadin.server.ErrorEvent event) { Throwable cause = event.getThrowable(); log.error("an error occured", cause); while(cause.getCause() != null) cause = cause.getCause(); Notification.show("Error", cause.getMessage(), Notification.Type.ERROR_MESSAGE); } });
.findErrorHandler(vaadinSession); errorHandler.error(new ErrorEvent(t));
/** * Call the session's error handler. */ private void callErrorHandler(VaadinSession session, Exception e) { session.getErrorHandler().error(new ErrorEvent(e)); }
private void handleError(Exception e) { com.vaadin.server.ErrorEvent.findErrorHandler(Grid.this) .error(new ConnectorErrorEvent(Grid.this, e)); } });
private static Throwable getRootExceptionFrom(final ErrorEvent event) { return getRootCauseOf(event.getThrowable()); }
/** * Handles exceptions thrown during the execution of this task. * * @param exception * the thrown exception. */ public void handleError(Exception exception) { try { if (command instanceof ErrorHandlingCommand) { ErrorHandlingCommand errorHandlingCommand = (ErrorHandlingCommand) command; errorHandlingCommand.handleError(exception); } else { ErrorEvent errorEvent = new ErrorEvent(exception); ErrorHandler errorHandler = ErrorEvent .findErrorHandler(session); if (errorHandler == null) { errorHandler = new DefaultErrorHandler(); } errorHandler.error(errorEvent); } } catch (Exception e) { getLogger().log(Level.SEVERE, e.getMessage(), e); } }
@Override public void handleError(Exception exception) { try { if (command instanceof ErrorHandlingCommand) { ErrorHandlingCommand errorHandlingCommand = (ErrorHandlingCommand) command; errorHandlingCommand.handleError(exception); } else { getSession().getErrorHandler() .error(new ErrorEvent(exception)); } } catch (Exception e) { getLogger().log(Level.SEVERE, e.getMessage(), e); } } });
com.vaadin.server.ErrorEvent.findErrorHandler(Grid.this).error( new ConnectorErrorEvent(Grid.this, event.getCause()));
@Override public void error(ErrorEvent event) { Throwable t = findRelevantThrowable(event.getThrowable()); // print the error on console getLogger().log(Level.SEVERE, "", t); }