Search in sources :

Example 1 with ServerOfflineEvent

use of org.rstudio.studio.client.application.events.ServerOfflineEvent in project rstudio by rstudio.

the class RemoteServer method handleRpcErrorInternally.

private boolean handleRpcErrorInternally(RpcError error) {
    if (error.getCode() == RpcError.UNAUTHORIZED) {
        handleUnauthorizedError();
        return true;
    } else if (error.getCode() == RpcError.INVALID_CLIENT_ID) {
        // disconnect
        disconnect();
        // fire event
        ClientDisconnectedEvent event = new ClientDisconnectedEvent();
        eventBus_.fireEvent(event);
        // handled
        return true;
    } else if (error.getCode() == RpcError.INVALID_CLIENT_VERSION) {
        // disconnect
        disconnect();
        // fire event
        InvalidClientVersionEvent event = new InvalidClientVersionEvent();
        eventBus_.fireEvent(event);
        // handled
        return true;
    } else if (error.getCode() == RpcError.SERVER_OFFLINE) {
        // disconnect
        disconnect();
        // fire event
        ServerOfflineEvent event = new ServerOfflineEvent();
        eventBus_.fireEvent(event);
        // handled
        return true;
    } else if (error.getCode() == RpcError.INVALID_SESSION) {
        // disconnect
        disconnect();
        // fire event
        InvalidSessionInfo info = error.getClientInfo().isObject().getJavaScriptObject().cast();
        InvalidSessionEvent event = new InvalidSessionEvent(info);
        eventBus_.fireEvent(event);
        // handled
        return true;
    } else {
        return false;
    }
}
Also used : ClientDisconnectedEvent(org.rstudio.studio.client.application.events.ClientDisconnectedEvent) ServerOfflineEvent(org.rstudio.studio.client.application.events.ServerOfflineEvent) InvalidSessionInfo(org.rstudio.studio.client.application.model.InvalidSessionInfo) InvalidClientVersionEvent(org.rstudio.studio.client.application.events.InvalidClientVersionEvent) InvalidSessionEvent(org.rstudio.studio.client.application.events.InvalidSessionEvent)

Aggregations

ClientDisconnectedEvent (org.rstudio.studio.client.application.events.ClientDisconnectedEvent)1 InvalidClientVersionEvent (org.rstudio.studio.client.application.events.InvalidClientVersionEvent)1 InvalidSessionEvent (org.rstudio.studio.client.application.events.InvalidSessionEvent)1 ServerOfflineEvent (org.rstudio.studio.client.application.events.ServerOfflineEvent)1 InvalidSessionInfo (org.rstudio.studio.client.application.model.InvalidSessionInfo)1