From: Kai Moritz Date: Sat, 7 Nov 2015 14:48:37 +0000 (+0100) Subject: GraphApiErrorHandler only handles status-code 400 BAD REQUEST X-Git-Tag: facebook-utils-2.5.0~6 X-Git-Url: https://juplo.de/gitweb/?p=facebook-errors;a=commitdiff_plain;h=d4becb14d3018c81601b8bd43c21ea51cc4f67d7 GraphApiErrorHandler only handles status-code 400 BAD REQUEST Alle error-responses of the Facebook Graph-API are send with the HTTP-status-code 400 BAD REQUEST. 401 UNAUTHORIZED and 403 FORBIDDEN are not used. --- diff --git a/src/main/java/de/juplo/facebook/client/GraphApiErrorHandler.java b/src/main/java/de/juplo/facebook/client/GraphApiErrorHandler.java index 2b73e49..a8b2d28 100644 --- a/src/main/java/de/juplo/facebook/client/GraphApiErrorHandler.java +++ b/src/main/java/de/juplo/facebook/client/GraphApiErrorHandler.java @@ -16,12 +16,12 @@ import org.springframework.web.client.ResponseErrorHandler; * Error-Handler for error-messages from the Facebook Graph-API. *

* This error-handler handels responses withe the HTTP-status code - * {@code 4xx}. It tries to extract and parse the error-message + * {@code 400 BAD REQUEST}. It tries to extract and parse the error-message * from the HTTP-body. Successfully extracted and parsed messages are mapped * to a hierarchy of exceptions, that reflects the hierarchy of the error- * codes and -types. *

- * If the HTTP-status-code of the response is not {@code 4xx} or + * If the HTTP-status-code of the response is not {@code 400 BAD REQUEST} or * the HTTP-body could not be extracted or parsed, this error-handler * delegates the handling to its parent. * @@ -51,10 +51,9 @@ public class GraphApiErrorHandler implements ResponseErrorHandler @Override public void handleError(final ClientHttpResponse response) throws IOException { - if (!HttpStatus.Series.CLIENT_ERROR.equals(response.getStatusCode().series())) + if (!HttpStatus.BAD_REQUEST.equals(response.getStatusCode())) { - // Let the parent-error-handler handle all errors, that are no client - // errors (4xx). + // We will only handle 400 BAD REQUEST parent.handleError(response); return; }