case 2: return new UnexpectedErrorException();
case 21: return new PageMigratedException(message);
case 100: return new UnsupportedGetRequestException();
+ case 613: return new RateExceededException();
default: return new GraphApiException(message, type, code);
}
}
case 2: return new UnexpectedErrorException();
case 21: return new PageMigratedException(message);
case 100: return new UnsupportedGetRequestException();
+ case 613: return new RateExceededException();
default: return new GraphApiException(message, type, code);
}
}
--- /dev/null
+package de.juplo.facebook;
+
+
+/**
+ *
+ * @author kai
+ */
+public class RateExceededException extends OAuthException
+{
+ public RateExceededException()
+ {
+ super("(#613) Calls to stream have exceeded the rate of 600 calls per 600 seconds.", 613);
+ }
+}
}
}
+ @Test
+ public void testError613()
+ {
+ log.info("testError613");
+
+
+ requestFactory.setBody(
+ "{\n" +
+ " \"error\":\n" +
+ " {\n" +
+ " \"message\": \"(#613) Calls to stream have exceeded the rate of 600 calls per 600 seconds.\",\n" +
+ " \"type\": \"OAuthException\",\n" +
+ " \"code\": 613\n" +
+ " }\n" +
+ "}");
+
+ try
+ {
+ clientTemplate.getForObject("ANY", SOME.class);
+ fail("The expected exception was not thrown");
+ }
+ catch(RateExceededException e)
+ {
+ log.debug("{}", e.toString());
+ assertEquals("invalid_request", e.getOAuth2ErrorCode());
+ assertEquals(613, e.getCode());
+ assertEquals("(#613) Calls to stream have exceeded the rate of 600 calls per 600 seconds.", e.getMessage());
+ assertEquals("OAuthException", e.getType());
+ }
+ }
+
@Test
public void testUnmappedError()
{