From 6711d13c296f9375f3e264cf8a1301346ce06237 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Fri, 22 Nov 2019 08:41:52 +0100 Subject: [PATCH] WIP: 2200: An active access token must be used TODO: Rename... 2500: An active access token must be used --- .../ActiveAccessTokenMissingException.java | 23 +++++++++++++++++++ .../facebook/errors/GraphApiException.java | 1 + .../errors/GraphApiExceptionTest.java | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/main/java/de/juplo/facebook/errors/ActiveAccessTokenMissingException.java diff --git a/src/main/java/de/juplo/facebook/errors/ActiveAccessTokenMissingException.java b/src/main/java/de/juplo/facebook/errors/ActiveAccessTokenMissingException.java new file mode 100644 index 0000000..ca7be15 --- /dev/null +++ b/src/main/java/de/juplo/facebook/errors/ActiveAccessTokenMissingException.java @@ -0,0 +1,23 @@ +package de.juplo.facebook.errors; + + +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + + + +/** + * 2200: Callback verification failed. + * @author Kai Moritz + */ +public class ActiveAccessTokenMissingException extends OAuthException +{ + protected ActiveAccessTokenMissingException( + 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 3e73807..0cc1961 100644 --- a/src/main/java/de/juplo/facebook/errors/GraphApiException.java +++ b/src/main/java/de/juplo/facebook/errors/GraphApiException.java @@ -208,6 +208,7 @@ public class GraphApiException extends RuntimeException // 1100..1199: live-message errors case 1609005: return new LinkPostFailureException(status, headers, error); case 2200: return new CallbackVerificationFailedException(status, headers, error); + case 2500: return new ActiveAccessTokenMissingException(status, headers, error); default: GraphApiException e = new UnmappedErrorException(status, headers, error); diff --git a/src/test/java/de/juplo/facebook/errors/GraphApiExceptionTest.java b/src/test/java/de/juplo/facebook/errors/GraphApiExceptionTest.java index 9d55e85..a164d89 100644 --- a/src/test/java/de/juplo/facebook/errors/GraphApiExceptionTest.java +++ b/src/test/java/de/juplo/facebook/errors/GraphApiExceptionTest.java @@ -246,7 +246,7 @@ public class GraphApiExceptionTest } @Test - public void testError2200() + public void testError2500() { String str ="{\"error\":{\"message\":\"An active access token must be used to query information about the current user.\",\"type\":\"OAuthException\",\"code\":2500,\"fbtrace_id\":\"AUmMHJlVYvTbQrBT11Dk104\"}}"; byte[] message = str.getBytes(); -- 2.20.1