/** * Call the session's error handler. */ private void callErrorHandler(VaadinSession session, Exception e) { session.getErrorHandler().error(new ErrorEvent(e)); }
/** * 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().error(e.getMessage(), e); } }
@Override public void error(ErrorEvent event) { Throwable t = findRelevantThrowable(event.getThrowable()); // print the error on console getLogger().error("", t); }
private void handleInvocationData(UI ui, JsonObject invocationJson) { String type = invocationJson.getString(JsonConstants.RPC_TYPE); RpcInvocationHandler handler = getInvocationHandlers().get(type); if (handler == null) { throw new IllegalArgumentException( "Unsupported event type: " + type); } try { Optional<Runnable> handle = handler.handle(ui, invocationJson); assert !handle.isPresent() : "RPC handler " + handler.getClass().getName() + " returned a Runnable even though it shouldn't"; } catch (Exception e) { ui.getSession().getErrorHandler().error(new ErrorEvent(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().error(e.getMessage(), e); } } });
private void onVaadinSessionStarted(VaadinRequest request, VaadinSession session) { 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)); } } }
private void handleStream(VaadinSession session, StreamReceiver streamReceiver, StateNode owner, long contentLength, FileItemStream item) throws IOException { String name = item.getName(); InputStream stream = item.openStream(); try { handleFileUploadValidationAndData(session, stream, streamReceiver, name, item.getContentType(), contentLength, owner); } catch (UploadException e) { session.getErrorHandler().error(new ErrorEvent(e)); } }
filename, mimeType, contentLength, owner); } catch (UploadException e) { session.getErrorHandler().error(new ErrorEvent(e));
vaadinSession.getErrorHandler().error(new ErrorEvent(t));
session.getErrorHandler().error(new ErrorEvent(e));
session.lock(); try { session.getErrorHandler().error(new ErrorEvent(e)); } finally { session.unlock();