com.google.gwt.user.client.rpc.StatusCodeException Java Examples

The following examples show how to use com.google.gwt.user.client.rpc.StatusCodeException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultCommandController.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void onFailure(Throwable caught) {
	if (caught instanceof StatusCodeException) {
		GWT.reportUncaughtException(caught);
	} else {
		for (Request request : this.requests) {
			if (request.param.getCallbacks().isEmpty()) {
				GWT.reportUncaughtException(caught);
			}
			for (AsyncCallback requestCallback : request.param.getCallbacks()) {
				requestCallback.onFailure(caught);
			}
		}
		if (this.callback != null) {
			this.callback.onFailure(caught);
		}
	}
}
 
Example #2
Source File: OdeAsyncCallback.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
@Override
public void onFailure(Throwable caught) {
  if (caught instanceof IncompatibleRemoteServiceException) {
    ErrorReporter.reportError("App Inventor has just been upgraded, you will need to press the reload button in your browser window");
    return;
  }
  if (caught instanceof InvalidSessionException) {
    Ode.getInstance().invalidSessionDialog();
    return;
  }
  if (caught instanceof ChecksumedFileException) {
    Ode.getInstance().corruptionDialog();
    return;
  }
  if (caught instanceof BlocksTruncatedException) {
    OdeLog.log("Caught BlocksTruncatedException");
    ErrorReporter.reportError("Caught BlocksTruncatedException");
    return;
  }
  // SC_PRECONDITION_FAILED if our session has expired or login cookie
  // has become invalid
  if ((caught instanceof StatusCodeException) &&
    ((StatusCodeException)caught).getStatusCode() == Response.SC_PRECONDITION_FAILED) {
    Ode.getInstance().sessionDead();
    return;
  }
  String errorMessage =
      (failureMessage == null) ? caught.getMessage() : failureMessage;
  ErrorReporter.reportError(errorMessage);
  OdeLog.elog("Got exception: " + caught.getMessage());
  Throwable cause = caught.getCause();
  if (cause != null) {
    OdeLog.elog("Caused by: " + cause.getMessage());
  }
}
 
Example #3
Source File: ServerErrorHandler.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected boolean internalHandle(StatusCodeException error) {
	if (ErrorManager.get().hasErrorDisplayer()) {
		String title = ((ServerErrorConstants) this.getConstants()).serverErrorTitle();
		ErrorManager.get().getErrorDisplayer().display(title, this.getErrorMessage(error), error, Severity.DANGER);
	}
	return true;
}
 
Example #4
Source File: ClientErrorHandler.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected boolean internalHandle(StatusCodeException error) {
	if (ErrorManager.get().hasErrorDisplayer()) {
		String title = ((ClientErrorConstants) this.getConstants()).clientErrorTitle();
		ErrorManager.get().getErrorDisplayer().display(title, this.getErrorMessage(error), error, Severity.DANGER);
	}
	return true;
}
 
Example #5
Source File: AbstractStatusCodeErrorHandler.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public boolean handle(Throwable error) {
	if (!(error instanceof StatusCodeException)) {
		return false;
	}
	StatusCodeException statusCodeExc = (StatusCodeException) error;
	if (this.handlesCode(statusCodeExc.getStatusCode())) {
		return this.internalHandle(statusCodeExc);
	}
	return false;
}
 
Example #6
Source File: AbstractStatusCodeErrorHandler.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected String getErrorMessage(StatusCodeException exception) {
	try {
		return this.constants.getString(this.constantsPrefix + exception.getStatusCode());
	} catch (MissingResourceException exc) {
		return exception.getStatusText();
	}
}
 
Example #7
Source File: UserInfo.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * refreshConnectedUsers
 */
private void refreshConnectedUsers() {
	getLoggedUsers = true;

	if (chatConnected) {
		chatService.getLoggedUsers(new AsyncCallback<List<GWTUser>>() {
			@Override
			public void onSuccess(List<GWTUser> result) {
				connectUsersList = result;
				usersConnected.setHTML(connectUsersList.size() + "");
				getLoggedUsers = false;

				new Timer() {
					@Override
					public void run() {
						refreshConnectedUsers();
					}
				}.schedule(USERS_IN_ROOM_REFRESHING_TIME);
			}

			@Override
			public void onFailure(Throwable caught) {
				Log.error(UserInfo.class + ".refreshConnectedUsers().onFailure(" + caught + ")");
				getLoggedUsers = false;

				if (caught instanceof StatusCodeException && ((StatusCodeException) caught).getStatusCode() == 0) {
					new Timer() {
						@Override
						public void run() {
							refreshConnectedUsers();
						}
					}.schedule(USERS_IN_ROOM_REFRESHING_TIME);
				} else {
					Main.get().showError("UserInfo.refreshConnectedUsers", caught);
				}
			}
		});
	} else {
		getLoggedUsers = false;
	}
}
 
Example #8
Source File: UserInfo.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * getPendingChatRoomUser
 */
private void getPendingChatRoomUser() {
	getPendingChatRoomUser = true;

	if (chatConnected) {
		chatService.getPendingChatRoomUser(new AsyncCallback<List<String>>() {
			@Override
			public void onSuccess(List<String> result) {
				for (String room : result) {
					ChatRoomPopup chatRoomPopup = new ChatRoomPopup("", room);
					chatRoomPopup.center();
					chatRoomPopup.getPendingMessage(room);
					addChatRoom(chatRoomPopup);
				}

				getPendingChatRoomUser = false;

				new Timer() {
					@Override
					public void run() {
						getPendingChatRoomUser();
					}
				}.schedule(NEW_ROOM_REFRESHING_TIME);
			}

			@Override
			public void onFailure(Throwable caught) {
				Log.error(UserInfo.class + ".getPendingChatRoomUser().onFailure(" + caught + ")");
				getPendingChatRoomUser = false;

				if (caught instanceof StatusCodeException && ((StatusCodeException) caught).getStatusCode() == 0) {
					new Timer() {
						@Override
						public void run() {
							getPendingChatRoomUser();
						}
					}.schedule(NEW_ROOM_REFRESHING_TIME);
				} else {
					Main.get().showError("UserInfo.getPendingChatRoomUser", caught);
				}
			}
		});
	} else {
		getPendingChatRoomUser = false;
	}
}
 
Example #9
Source File: InputFile.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void handleError(String statusCode, String encodedResponse) {
	this.fileId = null;
	progressBar.setValue(0);
	StyleUtils.addStyle(this, STYLE_ERROR);
	throw new StatusCodeException(Integer.parseInt(statusCode), encodedResponse);
}
 
Example #10
Source File: AbstractStatusCodeErrorHandler.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 votes vote down vote up
protected abstract boolean internalHandle(StatusCodeException error);