@Override public Type<AsyncCallFailHandler> getAssociatedType() { return getType(); }
/** * Fires a {@link AsyncCallFailEvent} * into a source that has access to an {@link com.google.web.bindery.event.shared.EventBus}. * * @param source The source that fires this event ({@link EventBus}). * @param caught failure encountered while executing a remote procedure call. */ public static void fire(EventBus source, Throwable caught) { source.fireEvent(new AsyncCallFailEvent(caught)); }
@Override public final void onFailure(final Throwable caught) { assert state == State.INITIALIZED || state == State.LOADING; if (state == State.LOADING) { counter--; if (counter == 0) { AsyncCallFailEvent.fire(eventBus, caught); } } state = State.FAILED; failure(caught); }
@Override public void onAsyncCallFail(AsyncCallFailEvent event) { Throwable caught = event.getCaught(); logger.warning("Error while performing async call: " + caught.getLocalizedMessage()); //$NON-NLS-1$ errorPopupManager.show(messages.asyncCallFailure(caught.getLocalizedMessage())); }
@Inject public AsyncCallFailureHandler(EventBus eventBus, ErrorPopupManager errorPopupManager) { this.errorPopupManager = errorPopupManager; eventBus.addHandler(AsyncCallFailEvent.getType(), this); }