Errors during parsing of the error-message are wrapped
[facebook-errors] / src / main / java / de / juplo / facebook / errors / ErrorResponseParsingErrorException.java
diff --git a/src/main/java/de/juplo/facebook/errors/ErrorResponseParsingErrorException.java b/src/main/java/de/juplo/facebook/errors/ErrorResponseParsingErrorException.java
new file mode 100644 (file)
index 0000000..60dcb6b
--- /dev/null
@@ -0,0 +1,38 @@
+package de.juplo.facebook.errors;
+
+
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+
+
+
+
+/**
+ * Exception that is thrown, if anything went wrong while parsing the
+ * error-response.
+ *
+ * @author Kai Moritz
+ */
+public class ErrorResponseParsingErrorException extends GraphApiException
+{
+  public final Exception cause;
+
+
+  protected  ErrorResponseParsingErrorException(
+      HttpStatus status,
+      HttpHeaders headers,
+      Exception cause
+      )
+  {
+    super(status, headers, new FacebookErrorMessage(cause));
+    this.cause = cause;
+  }
+
+
+
+  @Override
+  public String toString()
+  {
+    return "Error during parsing the error-response: " + cause.toString();
+  }
+}