--- /dev/null
+package de.juplo.facebook.errors;
+
+
+import java.io.IOException;
+import java.util.List;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.client.ClientHttpResponse;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.security.oauth2.client.http.OAuth2ErrorHandler;
+import org.springframework.web.client.ResponseErrorHandler;
+
+
+
+/**
+ *
+ * @author Kai Moritz
+ */
+public class OAuth2GraphApiErrorHandler extends OAuth2ErrorHandler
+{
+ private final OAuth2ErrorHandler parent;
+
+
+ public OAuth2GraphApiErrorHandler(OAuth2ErrorHandler handler)
+ {
+ super(null);
+ parent = handler;
+ }
+
+
+ @Override
+ public boolean hasError(ClientHttpResponse response) throws IOException
+ {
+ return
+ HttpStatus.Series.CLIENT_ERROR.equals(response.getStatusCode().series())
+ || parent.hasError(response);
+ }
+
+ @Override
+ public void handleError(ClientHttpResponse response) throws IOException
+ {
+ GraphApiErrorHandler.handleError(parent, response);
+ }
+
+ @Override
+ public void setMessageConverters(List<HttpMessageConverter<?>> converters)
+ {
+ parent.setMessageConverters(converters);
+ }
+}