--- /dev/null
+package de.juplo.facebook.errors;
+
+
+
+/**
+ * 17: Account request limit reached.
+ * @author Kai Moritz
+ * @see https://developers.facebook.com/docs/graph-api/using-graph-api/#errors
+ */
+public class AccountRequestLimitReachedException extends OAuthException
+{
+ protected AccountRequestLimitReachedException(FacebookErrorMessage error)
+ {
+ super(error);
+ }
+}
--- /dev/null
+package de.juplo.facebook.errors;
+
+
+
+/**
+ * 4: (#4) Application request limit reached.
+ * @author Kai Moritz
+ */
+public class ApplicationRequestLimitReachedException extends OAuthException
+{
+ protected ApplicationRequestLimitReachedException(FacebookErrorMessage error)
+ {
+ super(error);
+ }
+}
--- /dev/null
+package de.juplo.facebook.errors;
+
+
+
+/**
+ * 613: Calls to stream have exceeded the rate of 600 calls per 600 seconds.
+ * Taken from https://developers.facebook.com/docs/graph-api/advanced/rate-limiting?locale=en_US#faq
+ * I'm seeing Error Code 613, what do I do?
+ * If your error response contains error_subcode 1996, Facebook has noticed inconsistent behavior in the API request volume of your app. If you have made any recent changes that affect the number of API requests, you may be encountering this error.
+ * If you do not see the subcode, your app is exceeding a custom rate limit. Please contact your Partner Manager for help resolving this issue.
+ * @author Kai Moritz
+ */
+public class CustomRequestLimitReachedException extends OAuthException
+{
+ protected CustomRequestLimitReachedException(FacebookErrorMessage error)
+ {
+ super(error);
+ }
+}
// 1..99: general errors
case 1: return new UnknownErrorException(error);
case 2: return new UnexpectedErrorException(error);
- case 4: return new TooManyAppCallsException(error);
+ case 4: return new ApplicationRequestLimitReachedException(error);
case 10: return new AuthorizationMissingException(error);
case 12: return new DeprecatedException(error);
- case 17: return new TooManyUserCallsException(error);
+ case 17: return new AccountRequestLimitReachedException(error);
case 21: return new PageMigratedException(error);
+ case 32: return new PageRequestLimitReachedException(error);
// 100..199: graph method errors
case 100: return new UnsupportedGetRequestException(error);
case 102: return new UserAccessTokenRequiredException(error);
// 500..599: application messaging errors ?
case 506: return new MultipleConcurrentPostsException(error);
// 600..699: FQL errors
- case 613: return new RateLimitExceededException(error);
+ case 613: return new CustomRequestLimitReachedException(error);
// 700..749: ref errors
// 750..799: application integration errors
// 900..949: application information errors
--- /dev/null
+package de.juplo.facebook.errors;
+
+
+
+/**
+ * 32: Account request limit reached.
+ * @author Kai Moritz
+ * @see https://developers.facebook.com/docs/graph-api/using-graph-api/#errors
+ */
+public class PageRequestLimitReachedException extends OAuthException
+{
+ protected PageRequestLimitReachedException(FacebookErrorMessage error)
+ {
+ super(error);
+ }
+}
+++ /dev/null
-package de.juplo.facebook.errors;
-
-
-
-/**
- * 613: Calls to stream have exceeded the rate of 600 calls per 600 seconds.
- * @author Kai Moritz
- */
-public class RateLimitExceededException extends OAuthException
-{
- protected RateLimitExceededException(FacebookErrorMessage error)
- {
- super(error);
- }
-}
+++ /dev/null
-package de.juplo.facebook.errors;
-
-
-
-/**
- * 4: To many API-calls
- * @author Kai Moritz
- * @see https://developers.facebook.com/docs/graph-api/using-graph-api/#errors
- */
-public class TooManyAppCallsException extends OAuthException
-{
- protected TooManyAppCallsException(FacebookErrorMessage error)
- {
- super(error);
- }
-}
+++ /dev/null
-package de.juplo.facebook.errors;
-
-
-
-/**
- * 17: To many API-usercalls
- * @author Kai Moritz
- * @see https://developers.facebook.com/docs/graph-api/using-graph-api/#errors
- */
-public class TooManyUserCallsException extends OAuthException
-{
- protected TooManyUserCallsException(FacebookErrorMessage error)
- {
- super(error);
- }
-}
}
}
+ @Test
+ public void testError4()
+ {
+ log.info("testError4");
+
+
+ requestFactory.setBody(
+ "{\n" +
+ " \"error\": {\n" +
+ " \"code\": 4, \n" +
+ " \"fbtrace_id\": \"HZRM6BTMu+D\", \n" +
+ " \"is_transient\": true, \n" +
+ " \"message\": \"(#4) Application request limit reached\", \n" +
+ " \"type\": \"OAuthException\"\n" +
+ " }\n" +
+ "}\n");
+
+ try
+ {
+ clientTemplate.getForObject("ANY", SOME.class);
+ fail("The expected exception was not thrown");
+ }
+ catch(ApplicationRequestLimitReachedException e)
+ {
+ log.debug("{}", e.toString());
+ assertEquals(new Integer(4), e.getCode());
+ assertEquals("(#4) Application request limit reached", e.getMessage());
+ assertEquals(Type.OAuthException, e.getType());
+ }
+ }
+
@Test
public void testError12()
{
clientTemplate.getForObject("ANY", SOME.class);
fail("The expected exception was not thrown");
}
- catch(RateLimitExceededException e)
+ catch(CustomRequestLimitReachedException e)
{
log.debug("{}", e.toString());
assertEquals(new Integer(613), e.getCode());