Prepared for next development iteration (5.0-SNAPSHOT)
[facebook-errors] / src / main / java / de / juplo / facebook / errors / GraphApiErrorHandler.java
index e541965..265f145 100644 (file)
@@ -80,7 +80,7 @@ public class GraphApiErrorHandler implements ResponseErrorHandler
 
     try
     {
-      error = GraphApiException.create(body);
+      error = GraphApiException.create(response.getStatusCode(), response.getHeaders(), body);
       if (LOG.isInfoEnabled())
         LOG.info("error-response: {}", new String(body, Charset.forName("UTF-8")));
     }
@@ -89,7 +89,12 @@ public class GraphApiErrorHandler implements ResponseErrorHandler
       // The body of the HTTP-message could not be parsed.
       // Let the parent error-handler try to handle the response.
 
-      LOG.warn("Could not convert the response into an exception, because the body is unparsable: {}", body);
+      LOG.warn(
+          "Could not convert the response into an exception, " +
+          "because the body is unparsable: error={}, body={}",
+          e.toString(),
+          new String(body, Charset.forName("UTF-8"))
+          );
 
       // To do so, we have to wrap the original response to fill in
       // the buffered body, if needed