--- /dev/null
+package de.juplo.facebook.errors;
+
+
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+
+
+
+
+/**
+ * 200: (#200) The user hasn't authorized the application to perform this action"
+ * @author Kai Moritz
+ */
+public class ApplicationNotAuthorizedByUserException extends OAuthException
+{
+ protected ApplicationNotAuthorizedByUserException(
+ HttpStatus status,
+ HttpHeaders headers,
+ FacebookErrorMessage error
+ )
+ {
+ super(status, headers, error);
+ }
+}
case 104: return new AccessTokenRequiredException(status, headers, error);
case 190: return new AccessTokenExpiredException(status, headers, error);
// 200..299: permission errors
- case 200:
+ case 200: return new ApplicationNotAuthorizedByUserException(status, headers, error);
case 201:
case 202:
case 203:
}
}
+ @Test
+ public void testError200()
+ {
+ log.info("testError200");
+
+ requestFactory.setBody("{\n" +
+ " \"error\": {\n" +
+ " \"message\": \"(#200) The user hasn't authorized the application to perform this action\",\n" +
+ " \"type\": \"OAuthException\",\n" +
+ " \"code\": 200\n" +
+ " }\n" +
+ "}");
+
+ try
+ {
+ clientTemplate.getForObject("ANY", SOME.class);
+ fail("The expected exception was not thrown");
+ }
+ catch(ApplicationNotAuthorizedByUserException e)
+ {
+ log.debug("{}", e.toString());
+ assertEquals(new Integer(200), e.getCode());
+ assertEquals("(#200) The user hasn't authorized the application to perform this action", e.getMessage());
+ assertEquals(Type.OAuthException, e.getType());
+ assertNull(e.getTraceId());
+ }
+ }
+
@Test
public void testError613()
{