<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
- <version>1.3.5.RELEASE</version>
+ <version>1.3.7.RELEASE</version>
</parent>
--- /dev/null
+package de.juplo.facebook.errors;
+
+
+
+/**
+ * 12: XYZ field is deprecated for versions vZ.Z and higher
+ * @author Kai Moritz
+ * @see https://developers.facebook.com/docs/graph-api/using-graph-api/#errors
+ */
+public class DeprecatedException extends OAuthException
+{
+ protected DeprecatedException(FacebookErrorMessage error)
+ {
+ super(error);
+ }
+}
case 2: return new UnexpectedErrorException(error);
case 4: return new TooManyAppCallsException(error);
case 10: return new AuthorizationMissingException(error);
+ case 12: return new DeprecatedException(error);
case 17: return new TooManyUserCallsException(error);
case 21: return new PageMigratedException(error);
// 100..199: graph method errors
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-de.juplo.facebook.errors.SpringSocialAutoConfiguration,\
-de.juplo.facebook.errors.OAuth2AutoConfiguration
+de.juplo.facebook.errors.FacebookErrorsSpringSocialAutoConfiguration,\
+de.juplo.facebook.errors.FacebookErrorsOAuth2AutoConfiguration
}
}
+ @Test
+ public void testError12()
+ {
+ log.info("testError12");
+
+
+ requestFactory.setBody(
+ "{\n" +
+ " \"error\":\n" +
+ " {\n" +
+ " \"message\": \"(#12) location field is deprecated for versions v2.5 and higher\",\n" +
+ " \"type\": \"OAuthException\",\n" +
+ " \"code\": 12\n," +
+ " \"fbtrace_id\":\"BoxCYne7GrL\"\n" +
+ " }\n" +
+ "}");
+
+ try
+ {
+ clientTemplate.getForObject("ANY", SOME.class);
+ fail("The expected exception was not thrown");
+ }
+ catch(DeprecatedException e)
+ {
+ log.debug("{}", e.toString());
+ assertEquals(new Integer(12), e.getCode());
+ assertEquals("(#12) location field is deprecated for versions v2.5 and higher", e.getMessage());
+ assertEquals(Type.OAuthException, e.getType());
+ }
+ }
+
@Test
public void testError21()
{