case 21: return new PageMigratedException(error);
// 100..199: graph method errors
case 100: return new UnsupportedGetRequestException(error);
+ case 102: return new UserAccessTokenRequiredException(error);
case 104: return new AccessTokenRequiredException(error);
// 200..299: permission errors
// 300..399: data editing errors
--- /dev/null
+package de.juplo.facebook.errors;
+
+
+
+/**
+ * A user access token is required to request this resource.
+ * @author Kai Moritz
+ */
+public class UserAccessTokenRequiredException extends OAuthException
+{
+ public UserAccessTokenRequiredException(FacebookErrorMessage error)
+ {
+ super(error);
+ }
+}
}
}
+ @Test
+ public void testError102()
+ {
+ log.info("testError102");
+
+ requestFactory.setBody("{\"error\":{\"message\":\"A user access token is required to request this resource.\",\"type\":\"OAuthException\",\"code\":102,\"fbtrace_id\":\"DhdMyf23Ki7\"}}");
+
+ try
+ {
+ clientTemplate.getForObject("ANY", SOME.class);
+ fail("The expected exception was not thrown");
+ }
+ catch(UserAccessTokenRequiredException e)
+ {
+ log.debug("{}", e.toString());
+ assertEquals("invalid_request", e.getOAuth2ErrorCode());
+ assertEquals(new Integer(102), e.getCode());
+ assertEquals("A user access token is required to request this resource.", e.getMessage());
+ assertEquals(Type.OAuthException, e.getType());
+ assertEquals("DhdMyf23Ki7", e.getTraceId());
+ }
+ }
+
@Test
public void testError104()
{