--- /dev/null
+package de.juplo.facebook.errors;
+
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+
+
+/**
+ * 21: Page ID (XXX) was migrated to page ID (YYY).
+ * @author Kai Moritz
+ */
+public class PageMigratedException extends OAuthException
+{
+ private final static Pattern pattern =
+ Pattern.compile("Page ID ([0-9]+) was migrated to page ID ([0-9]+)");
+
+ private final Long oldId, newId;
+
+
+ protected PageMigratedException(FacebookErrorMessage error)
+ {
+ super(error);
+ Matcher matcher = pattern.matcher(error.message);
+ if (!matcher.find())
+ {
+ String warning = "Could not parse migration-error: " + error.message;
+ LOG.error(warning);
+ throw new RuntimeException(warning);
+ }
+ oldId = Long.parseLong(matcher.group(1));
+ newId = Long.parseLong(matcher.group(2));
+ }
+
+
+ public Long getOldId()
+ {
+ return oldId;
+ }
+
+ public Long getNewId()
+ {
+ return newId;
+ }
+}