Search in sources :

Example 1 with ServerUnavailableException

use of com.google.gwtjsonrpc.client.ServerUnavailableException in project gerrit by GerritCodeReview.

the class GerritCallback method showFailure.

public static void showFailure(Throwable caught) {
    if (isSigninFailure(caught)) {
        new NotSignedInDialog().center();
    } else if (isNoSuchEntity(caught)) {
        new ErrorDialog(Gerrit.C.notFoundBody()).center();
    } else if (isNoSuchAccount(caught)) {
        final String msg = caught.getMessage();
        final String who = msg.substring(NoSuchAccountException.MESSAGE.length());
        final ErrorDialog d = new ErrorDialog(Gerrit.M.noSuchAccountMessage(who));
        d.setText(Gerrit.C.noSuchAccountTitle());
        d.center();
    } else if (isNameAlreadyUsed(caught)) {
        final String msg = caught.getMessage();
        final String alreadyUsedName = msg.substring(NameAlreadyUsedException.MESSAGE.length());
        new ErrorDialog(Gerrit.M.nameAlreadyUsedBody(alreadyUsedName)).center();
    } else if (isNoSuchGroup(caught)) {
        final String msg = caught.getMessage();
        final String group = msg.substring(NoSuchGroupException.MESSAGE.length());
        final ErrorDialog d = new ErrorDialog(Gerrit.M.noSuchGroupMessage(group));
        d.setText(Gerrit.C.noSuchGroupTitle());
        d.center();
    } else if (caught instanceof ServerUnavailableException) {
        new ErrorDialog(RpcConstants.C.errorServerUnavailable()).center();
    } else {
        new ErrorDialog(caught).center();
    }
}
Also used : NotSignedInDialog(com.google.gerrit.client.NotSignedInDialog) ServerUnavailableException(com.google.gwtjsonrpc.client.ServerUnavailableException) ErrorDialog(com.google.gerrit.client.ErrorDialog)

Aggregations

ErrorDialog (com.google.gerrit.client.ErrorDialog)1 NotSignedInDialog (com.google.gerrit.client.NotSignedInDialog)1 ServerUnavailableException (com.google.gwtjsonrpc.client.ServerUnavailableException)1