From: Kai Moritz Date: Tue, 29 Oct 2019 15:25:52 +0000 (+0100) Subject: Renamed exception for rate-limit-exceeded X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=874954203f56e8880e9bfc9d9df98a5d985baea7;p=facebook-errors Renamed exception for rate-limit-exceeded --- diff --git a/src/main/java/de/juplo/facebook/errors/CustomRequestLimitReachedException.java b/src/main/java/de/juplo/facebook/errors/CustomRequestLimitReachedException.java deleted file mode 100644 index be3caa2..0000000 --- a/src/main/java/de/juplo/facebook/errors/CustomRequestLimitReachedException.java +++ /dev/null @@ -1,28 +0,0 @@ -package de.juplo.facebook.errors; - - -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; - - - - -/** - * 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( - HttpStatus status, - HttpHeaders headers, - FacebookErrorMessage error - ) - { - super(status, headers, error); - } -} diff --git a/src/main/java/de/juplo/facebook/errors/GraphApiException.java b/src/main/java/de/juplo/facebook/errors/GraphApiException.java index 7263c4f..31c23dc 100644 --- a/src/main/java/de/juplo/facebook/errors/GraphApiException.java +++ b/src/main/java/de/juplo/facebook/errors/GraphApiException.java @@ -200,7 +200,7 @@ public class GraphApiException extends RuntimeException // 500..599: application messaging errors ? case 506: return new MultipleConcurrentPostsException(status, headers, error); // 600..699: FQL errors - case 613: return new CustomRequestLimitReachedException(status, headers, error); + case 613: return new RateLimitExceededException(status, headers, error); // 700..749: ref errors // 750..799: application integration errors // 900..949: application information errors diff --git a/src/main/java/de/juplo/facebook/errors/RateLimitExceededException.java b/src/main/java/de/juplo/facebook/errors/RateLimitExceededException.java new file mode 100644 index 0000000..e0d9589 --- /dev/null +++ b/src/main/java/de/juplo/facebook/errors/RateLimitExceededException.java @@ -0,0 +1,28 @@ +package de.juplo.facebook.errors; + + +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + + + + +/** + * 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 RateLimitExceededException extends OAuthException +{ + protected RateLimitExceededException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) + { + super(status, headers, error); + } +} diff --git a/src/test/java/de/juplo/facebook/errors/GraphApiErrorHandlerTest.java b/src/test/java/de/juplo/facebook/errors/GraphApiErrorHandlerTest.java index 185fd2b..dde664e 100644 --- a/src/test/java/de/juplo/facebook/errors/GraphApiErrorHandlerTest.java +++ b/src/test/java/de/juplo/facebook/errors/GraphApiErrorHandlerTest.java @@ -275,7 +275,7 @@ public class GraphApiErrorHandlerTest clientTemplate.getForObject("ANY", SOME.class); fail("The expected exception was not thrown"); } - catch(CustomRequestLimitReachedException e) + catch(RateLimitExceededException e) { log.debug("{}", e.toString()); assertEquals(new Integer(613), e.getCode());