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); }
private static Throwable getRootExceptionFrom(final ErrorEvent event) { return getRootCauseOf(event.getThrowable()); }
@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); } });
private static Throwable getRootExceptionFrom(final ErrorEvent event) { return getRootCauseOf(event.getThrowable()); }
@Override public void error(ErrorEvent event) { Throwable t = findRelevantThrowable(event.getThrowable()); // print the error on console getLogger().log(Level.SEVERE, "", t); }
/** * @see com.vaadin.server.DefaultErrorHandler#error(com.vaadin.server.ErrorEvent) */ @Override public void error(ErrorEvent event) { super.error(event); if (m_ui != null) { m_ui.onError(); } Throwable throwable = event.getThrowable(); if (!(throwable instanceof SocketException)) { LOG.error(throwable.getLocalizedMessage(), throwable); } }
@Override public void error(com.vaadin.server.ErrorEvent event) { try { app.getExceptionHandlers().handle(event); app.getAppLog().log(event); } catch (Throwable e) { log.error("Error handling exception\nOriginal exception:\n{}\nException in handlers:\n{}", ExceptionUtils.getStackTrace(event.getThrowable()), ExceptionUtils.getStackTrace(e)); } }
protected void setUploadingErrorHandler() { setErrorHandler(event -> { //noinspection ThrowableResultOfMethodCallIgnored Throwable ex = event.getThrowable(); String rootCauseMessage = ExceptionUtils.getRootCauseMessage(ex); Logger log = LoggerFactory.getLogger(CubaFileUpload.class); if (StringUtils.contains(rootCauseMessage, "The multipart stream ended unexpectedly") || StringUtils.contains(rootCauseMessage, "Unexpected EOF read on the socket")) { log.warn("Unable to upload file, it seems upload canceled or network error occurred"); } else { log.error("Unexpected error in CubaFileUpload", ex); } if (isUploading) { endUpload(); } }); }
@Override public void error(ErrorEvent event) { Throwable t = event.getThrowable(); while (t != null) { if (t instanceof ValidationException) { ret.setComponentError(new UserError(((ValidationException)t).getMessage())); } t = t.getCause(); } }});
public void error(ErrorEvent event) { Throwable t = event.getThrowable(); while (t != null) { if (t instanceof ValidationException) { ret.setComponentError(new UserError(((ValidationException)t).getMessage())); } t = t.getCause(); } }}); if (ret instanceof AbstractSelect) {
public void error(ErrorEvent event) { Throwable t = event.getThrowable(); while (t != null) { if (t instanceof ValidationException) { ret.setComponentError(new UserError(((ValidationException)t).getMessage())); } t = t.getCause(); } }});
@Override public void error(ErrorEvent event) { Throwable t = event.getThrowable(); while (t != null) { if (t instanceof ValidationException) { ret.setComponentError(new UserError(((ValidationException)t).getMessage())); } t = t.getCause(); } }}); ret.setBuffered(false);
private void handleError(com.vaadin.server.ErrorEvent event) { Throwable t = DefaultErrorHandler.findRelevantThrowable(event.getThrowable()); if (t instanceof AccessDeniedException) { Notification.show("You do not have permission to perform this operation", Notification.Type.WARNING_MESSAGE); } else { DefaultErrorHandler.doDefault(event); } } }
private void handleError(com.vaadin.server.ErrorEvent event) { Throwable t = DefaultErrorHandler.findRelevantThrowable(event.getThrowable()); if (t instanceof AccessDeniedException) { Notification.show("You do not have permission to perform this operation", Notification.Type.WARNING_MESSAGE); } else { DefaultErrorHandler.doDefault(event); } } }
@Override public boolean handle(ErrorEvent event, App app) { Throwable exception = event.getThrowable(); List<Throwable> list = ExceptionUtils.getThrowableList(exception); for (Throwable throwable : list) { if (classNames.contains(throwable.getClass().getName()) && canHandle(throwable.getClass().getName(), throwable.getMessage(), throwable)) { doHandle(app, throwable.getClass().getName(), throwable.getMessage(), throwable); return true; } if (throwable instanceof RemoteException) { RemoteException remoteException = (RemoteException) throwable; for (RemoteException.Cause cause : remoteException.getCauses()) { if (classNames.contains(cause.getClassName()) && canHandle(cause.getClassName(), cause.getMessage(), cause.getThrowable())) { doHandle(app, cause.getClassName(), cause.getMessage(), cause.getThrowable()); return true; } } } } return false; }
@Override public boolean handle(ErrorEvent event, App app) { boolean handled = super.handle(event, app); if (handled && event.getThrowable() != null) { // Finds the original source of the error/exception AbstractComponent component = DefaultErrorHandler.findAbstractComponent(event); if (component != null) { component.markAsDirty(); } if (component instanceof Component.Focusable) { ((Component.Focusable) component).focus(); } } return handled; }
Throwable t = event.getThrowable(); if (t instanceof SocketException || ExceptionUtils.getRootCause(t) instanceof SocketException) {
/** * Delegates exception handling to registered handlers. * * @param event error event generated by Vaadin */ public void handle(ErrorEvent event) { for (ExceptionHandler handler : handlers) { if (handler.handle(event, app)) { return; } } AppUI ui = app.getAppUI(); if (ui != null) { for (UiExceptionHandler handler : genericHandlers) { if (handler.handle(event.getThrowable(), ui)) { return; } } } defaultHandler.handle(event, app); }
@Override public void error(com.vaadin.server.ErrorEvent event) { Throwable t = findNoSuchProviderException(event.getThrowable()); if (t instanceof NoSuchProviderException) { final NoSuchProviderException exception = (NoSuchProviderException) t; } else { Notification.show("An Unexpected Exception Occurred: see karaf.log", Notification.Type.TRAY_NOTIFICATION); LOG.warn("An Unexpected Exception Occurred: in the TopologyUI", event.getThrowable());
/** * Called when <em>the first</em> UI of the session is initialized. */ protected void init(Locale requestLocale) { VaadinSession vSession = VaadinSession.getCurrent(); vSession.setAttribute(App.class, this); vSession.setLocale(messageTools.getDefaultLocale()); // set root error handler for all session vSession.setErrorHandler(event -> { try { getExceptionHandlers().handle(event); getAppLog().log(event); } catch (Throwable e) { log.error("Error handling exception\nOriginal exception:\n{}\nException in handlers:\n{}", ExceptionUtils.getStackTrace(event.getThrowable()), ExceptionUtils.getStackTrace(e) ); } }); log.debug("Initializing application"); appLog = new AppLog(webConfig.getAppLogMaxItemsCount(), beanLocator.get(TimeSource.NAME)); connection = createConnection(); exceptionHandlers = new ExceptionHandlers(this, beanLocator); cookies = new AppCookies(); themeConstants = loadTheme(); // get default locale from config Locale targetLocale = resolveLocale(requestLocale); setLocale(targetLocale); }