use of edu.stanford.bmir.protege.web.shared.permissions.PermissionDeniedException in project webprotege by protegeproject.
the class DispatchServiceManager method handleError.
private void handleError(final Throwable throwable, final Action<?> action, final DispatchServiceCallback<?> callback) {
if (throwable instanceof PermissionDeniedException) {
// Try to determine if the user is logged in. The session might have expired.
UserInSession userInSession = ((PermissionDeniedException) throwable).getUserInSession();
if (userInSession.isGuest()) {
// Set up next place
Place continueTo = placeController.getWhere();
loggedInUser.setLoggedInUser(userInSession);
GWT.log("[Dispatch] Permission denied. User is the guest user so redirecting to login.");
signInRequiredHandler.handleSignInRequired(continueTo);
}
}
// Skip handling for actions that do not care about errors
if (action instanceof InvocationExceptionTolerantAction) {
Optional<String> errorMessage = ((InvocationExceptionTolerantAction) action).handleInvocationException((InvocationException) throwable);
errorMessage.ifPresent(this::displayAlert);
return;
}
callback.onFailure(throwable);
}
Aggregations