@Override public void onException(ChannelException e) { triggerOnException(e, null); terminate("WaveService raised exception (probably in translation): " + e); }
@Override public void onSuccess(String response) { boolean fatal = response != null; String errorMessage = fatal ? response : "<no remote error specified>"; switch (state) { case INITIAL: // We can't report a channel exception because there's no listener. Preconditions.illegalState("View channel received success before open: %s, response: %s", this, response); break; case CONNECTING: case CONNECTED: if (fatal) { triggerOnException(new ChannelException("Server unexpectedly closed channel" + " with error: " + errorMessage, Recoverable.NOT_RECOVERABLE), null); } terminate("Received onSuccess in state " + state + " with message: " + errorMessage); break; case CLOSING: state = State.CLOSED; break; // The ViewOpen RPC has completed, and the channel has closed. case CLOSED: // Even if there are outstanding RPCs since we are already closed // just be silent. break; default: Preconditions.illegalState("success in unknown state" + state); } }
checkUpdateProtocolRestrictions(update); } catch (ChannelException e) { triggerOnException(e, update.hasWaveletId() ? update.getWaveletId() : null); terminate("View update raised exception: " + e.toString()); triggerOnException(e, waveletId); terminate("View update raised exception: " + e.toString());