/** * Method for finding the error handler for the given session. * * @param session * the active session * @return An ErrorHandler for the session or null if none was found */ public static ErrorHandler findErrorHandler(VaadinSession session) { if (session == null) { return null; } return session.getErrorHandler(); }
/** * Call the session's error handler. */ private void callErrorHandler(VaadinSession session, Exception e) { session.getErrorHandler().error(new ErrorEvent(e)); }
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));
session.getErrorHandler().error(new ErrorEvent(e));
vaadinSession.getErrorHandler().error(new ErrorEvent(t));
session.lock(); try { session.getErrorHandler().error(new ErrorEvent(e)); } finally { session.unlock();