Reworked handling of error-responses from the Graph-API
[facebook-utils] / src / main / java / de / juplo / facebook / exceptions / PageMigratedException.java
index d327b6d..dfa76cf 100644 (file)
@@ -7,8 +7,8 @@ import java.util.regex.Pattern;
 
 
 /**
- *
- * @author kai
+ * 21: Page ID (XXX) was migrated to page ID (YYY).
+ * @author Kai Moritz
  */
 public class PageMigratedException extends OAuthException
 {
@@ -18,12 +18,12 @@ public class PageMigratedException extends OAuthException
   private final Long oldId, newId;
 
 
-  public PageMigratedException(String message)
+  protected PageMigratedException(FacebookErrorMessage error)
   {
-    super(message, 21);
-    Matcher matcher = pattern.matcher(message);
+    super(error);
+    Matcher matcher = pattern.matcher(error.message);
     if (!matcher.find())
-      throw new RuntimeException("Could not parse migration-error: " + message);
+      throw new RuntimeException("Could not parse migration-error: " + error.message);
     oldId = Long.parseLong(matcher.group(1));
     newId = Long.parseLong(matcher.group(2));
   }