protected void requiresAuthorization() { if (!isAuthorized) { throw new NotAuthorizedException("yahoo", "app has not been authorized"); } }
throw new NotAuthorizedException("twitter", response.getStatusText()); } else if (errorText.equals("Could not authenticate you.")) { throw new MissingAuthorizationException("twitter"); throw new InvalidAuthorizationException("twitter", errorText); } else { throw new NotAuthorizedException("twitter", errorText);
throw new NotAuthorizedException("twitter", response.getStatusText()); } else if (errorText.equals("Could not authenticate you.")) { throw new MissingAuthorizationException("twitter"); throw new InvalidAuthorizationException("twitter", errorText); } else { throw new NotAuthorizedException("twitter", errorText);
@Override public void handleError(ClientHttpResponse response) throws IOException { Map<String, Object> errorDetails = extractErrorDetailsFromResponse(response); String message = (String) errorDetails.get("message"); HttpStatus statusCode = response.getStatusCode(); if (statusCode.equals(HttpStatus.UNAUTHORIZED)) { throw new NotAuthorizedException("linkedIn", message); } else if (statusCode.equals(HttpStatus.FORBIDDEN)) { if (message.contains("Throttle")) { throw new RateLimitExceededException("linkedin"); } else { throw new InsufficientPermissionException("linkedin"); } } else if (statusCode.equals(HttpStatus.NOT_FOUND)) { throw new ResourceNotFoundException("linkedin", message); } handleUncategorizedError(response); }
@Override public void handleError(ClientHttpResponse response) throws IOException { Map<String, Object> errorDetails = extractErrorDetailsFromResponse(response); String message = (String) errorDetails.get("message"); HttpStatus statusCode = response.getStatusCode(); if (statusCode.equals(HttpStatus.UNAUTHORIZED)) { throw new NotAuthorizedException("linkedIn", message); } else if (statusCode.equals(HttpStatus.FORBIDDEN)) { if (message.contains("Throttle")) { throw new RateLimitExceededException("linkedin"); } else { throw new InsufficientPermissionException("linkedin"); } } else if (statusCode.equals(HttpStatus.NOT_FOUND)) { throw new ResourceNotFoundException("linkedin", message); } handleUncategorizedError(response); }