From e933b2164a38e39aa5caa81d720fd2d14c5c77dc Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Mon, 9 Jul 2018 21:00:42 +0200 Subject: [PATCH] The exception stores the HttpStatus and HttpHeaders of the failed request --- .../errors/AccessTokenRequiredException.java | 13 ++- .../AccountRequestLimitReachedException.java | 13 ++- ...plicationRequestLimitReachedException.java | 13 ++- .../errors/AuthorizationMissingException.java | 13 ++- .../CallbackVerificationFailedException.java | 13 ++- .../CustomRequestLimitReachedException.java | 13 ++- .../facebook/errors/DeprecatedException.java | 13 ++- .../facebook/errors/GraphApiErrorHandler.java | 2 +- .../facebook/errors/GraphApiException.java | 82 +++++++++++++------ .../facebook/errors/GraphMethodException.java | 13 ++- .../errors/LinkPostFailureException.java | 13 ++- .../MultipleConcurrentPostsException.java | 13 ++- .../errors/OAuth2GraphApiErrorHandler.java | 1 - .../juplo/facebook/errors/OAuthException.java | 13 ++- .../errors/PageMigratedException.java | 10 ++- .../PageRequestLimitReachedException.java | 13 ++- .../TemporaryRateLimitExceededException.java | 13 ++- .../errors/UnexpectedErrorException.java | 13 ++- .../errors/UnknownErrorException.java | 13 ++- .../errors/UnmappedErrorException.java | 13 ++- .../UnsupportedGetRequestException.java | 13 ++- .../UserAccessTokenRequiredException.java | 13 ++- 22 files changed, 264 insertions(+), 65 deletions(-) diff --git a/src/main/java/de/juplo/facebook/errors/AccessTokenRequiredException.java b/src/main/java/de/juplo/facebook/errors/AccessTokenRequiredException.java index 5b54096..980e2dc 100644 --- a/src/main/java/de/juplo/facebook/errors/AccessTokenRequiredException.java +++ b/src/main/java/de/juplo/facebook/errors/AccessTokenRequiredException.java @@ -1,6 +1,11 @@ package de.juplo.facebook.errors; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + + + /** * 104: An access token is required to request this resource. @@ -8,8 +13,12 @@ package de.juplo.facebook.errors; */ public class AccessTokenRequiredException extends OAuthException { - protected AccessTokenRequiredException(FacebookErrorMessage error) + protected AccessTokenRequiredException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { - super(error); + super(status, headers, error); } } diff --git a/src/main/java/de/juplo/facebook/errors/AccountRequestLimitReachedException.java b/src/main/java/de/juplo/facebook/errors/AccountRequestLimitReachedException.java index ab0af95..d21ed94 100644 --- a/src/main/java/de/juplo/facebook/errors/AccountRequestLimitReachedException.java +++ b/src/main/java/de/juplo/facebook/errors/AccountRequestLimitReachedException.java @@ -1,6 +1,11 @@ package de.juplo.facebook.errors; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + + + /** * 17: Account request limit reached. @@ -9,8 +14,12 @@ package de.juplo.facebook.errors; */ public class AccountRequestLimitReachedException extends OAuthException { - protected AccountRequestLimitReachedException(FacebookErrorMessage error) + protected AccountRequestLimitReachedException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { - super(error); + super(status, headers, error); } } diff --git a/src/main/java/de/juplo/facebook/errors/ApplicationRequestLimitReachedException.java b/src/main/java/de/juplo/facebook/errors/ApplicationRequestLimitReachedException.java index 6a2196c..1b52f27 100644 --- a/src/main/java/de/juplo/facebook/errors/ApplicationRequestLimitReachedException.java +++ b/src/main/java/de/juplo/facebook/errors/ApplicationRequestLimitReachedException.java @@ -1,6 +1,11 @@ package de.juplo.facebook.errors; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + + + /** * 4: (#4) Application request limit reached. @@ -8,8 +13,12 @@ package de.juplo.facebook.errors; */ public class ApplicationRequestLimitReachedException extends OAuthException { - protected ApplicationRequestLimitReachedException(FacebookErrorMessage error) + protected ApplicationRequestLimitReachedException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { - super(error); + super(status, headers, error); } } diff --git a/src/main/java/de/juplo/facebook/errors/AuthorizationMissingException.java b/src/main/java/de/juplo/facebook/errors/AuthorizationMissingException.java index 440684c..d6f94fd 100644 --- a/src/main/java/de/juplo/facebook/errors/AuthorizationMissingException.java +++ b/src/main/java/de/juplo/facebook/errors/AuthorizationMissingException.java @@ -1,6 +1,11 @@ package de.juplo.facebook.errors; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + + + /** * 10: Authorization declined / not granted @@ -10,8 +15,12 @@ package de.juplo.facebook.errors; */ public class AuthorizationMissingException extends OAuthException { - protected AuthorizationMissingException(FacebookErrorMessage error) + protected AuthorizationMissingException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { - super(error); + super(status, headers, error); } } diff --git a/src/main/java/de/juplo/facebook/errors/CallbackVerificationFailedException.java b/src/main/java/de/juplo/facebook/errors/CallbackVerificationFailedException.java index 27ef936..ede94d4 100644 --- a/src/main/java/de/juplo/facebook/errors/CallbackVerificationFailedException.java +++ b/src/main/java/de/juplo/facebook/errors/CallbackVerificationFailedException.java @@ -1,14 +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 CallbackVerificationFailedException extends OAuthException { - protected CallbackVerificationFailedException(FacebookErrorMessage error) + protected CallbackVerificationFailedException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { - super(error); + super(status, headers, error); } } diff --git a/src/main/java/de/juplo/facebook/errors/CustomRequestLimitReachedException.java b/src/main/java/de/juplo/facebook/errors/CustomRequestLimitReachedException.java index 7beaea2..be3caa2 100644 --- a/src/main/java/de/juplo/facebook/errors/CustomRequestLimitReachedException.java +++ b/src/main/java/de/juplo/facebook/errors/CustomRequestLimitReachedException.java @@ -1,6 +1,11 @@ package de.juplo.facebook.errors; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + + + /** * 613: Calls to stream have exceeded the rate of 600 calls per 600 seconds. @@ -12,8 +17,12 @@ package de.juplo.facebook.errors; */ public class CustomRequestLimitReachedException extends OAuthException { - protected CustomRequestLimitReachedException(FacebookErrorMessage error) + protected CustomRequestLimitReachedException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { - super(error); + super(status, headers, error); } } diff --git a/src/main/java/de/juplo/facebook/errors/DeprecatedException.java b/src/main/java/de/juplo/facebook/errors/DeprecatedException.java index 8274cb6..8438e27 100644 --- a/src/main/java/de/juplo/facebook/errors/DeprecatedException.java +++ b/src/main/java/de/juplo/facebook/errors/DeprecatedException.java @@ -1,6 +1,11 @@ package de.juplo.facebook.errors; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + + + /** * 12: XYZ field is deprecated for versions vZ.Z and higher @@ -9,8 +14,12 @@ package de.juplo.facebook.errors; */ public class DeprecatedException extends OAuthException { - protected DeprecatedException(FacebookErrorMessage error) + protected DeprecatedException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { - super(error); + super(status, headers, error); } } diff --git a/src/main/java/de/juplo/facebook/errors/GraphApiErrorHandler.java b/src/main/java/de/juplo/facebook/errors/GraphApiErrorHandler.java index fe2932c..265f145 100644 --- a/src/main/java/de/juplo/facebook/errors/GraphApiErrorHandler.java +++ b/src/main/java/de/juplo/facebook/errors/GraphApiErrorHandler.java @@ -80,7 +80,7 @@ public class GraphApiErrorHandler implements ResponseErrorHandler try { - error = GraphApiException.create(body); + error = GraphApiException.create(response.getStatusCode(), response.getHeaders(), body); if (LOG.isInfoEnabled()) LOG.info("error-response: {}", new String(body, Charset.forName("UTF-8"))); } diff --git a/src/main/java/de/juplo/facebook/errors/GraphApiException.java b/src/main/java/de/juplo/facebook/errors/GraphApiException.java index 53bbbe6..7263c4f 100644 --- a/src/main/java/de/juplo/facebook/errors/GraphApiException.java +++ b/src/main/java/de/juplo/facebook/errors/GraphApiException.java @@ -11,6 +11,8 @@ import java.io.IOException; import java.io.InputStream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; @@ -27,7 +29,9 @@ public class GraphApiException extends RuntimeException final static Logger LOG = LoggerFactory.getLogger(GraphApiException.class); final static ObjectMapper OBJECT_MAPPER; - private final FacebookErrorMessage error; + public final HttpStatus status; + public final HttpHeaders headers; + public final FacebookErrorMessage error; static @@ -39,42 +43,54 @@ public class GraphApiException extends RuntimeException } - public static GraphApiException create(InputStream in) + public static GraphApiException create( + HttpStatus status, + HttpHeaders headers, + InputStream in + ) throws IOException, JsonParseException, JsonMappingException { - return create(OBJECT_MAPPER.readValue(in, FacebookErrorMessage.class)); + return create(status, headers, OBJECT_MAPPER.readValue(in, FacebookErrorMessage.class)); } - public static GraphApiException create(byte[] message) + public static GraphApiException create( + HttpStatus status, + HttpHeaders headers, + byte[] message + ) throws IOException, JsonParseException, JsonMappingException { - return create(OBJECT_MAPPER.readValue(message, FacebookErrorMessage.class)); + return create(status, headers, OBJECT_MAPPER.readValue(message, FacebookErrorMessage.class)); } - public static GraphApiException create(FacebookErrorMessage error) + public static GraphApiException create( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { // see: http://fbdevwiki.com/wiki/Error_codes switch(error.code) { // 1..99: general errors - case 1: return new UnknownErrorException(error); - case 2: return new UnexpectedErrorException(error); - case 4: return new ApplicationRequestLimitReachedException(error); - case 10: return new AuthorizationMissingException(error); - case 12: return new DeprecatedException(error); - case 17: return new AccountRequestLimitReachedException(error); - case 21: return new PageMigratedException(error); - case 32: return new PageRequestLimitReachedException(error); + case 1: return new UnknownErrorException(status, headers, error); + case 2: return new UnexpectedErrorException(status, headers, error); + case 4: return new ApplicationRequestLimitReachedException(status, headers, error); + case 10: return new AuthorizationMissingException(status, headers, error); + case 12: return new DeprecatedException(status, headers, error); + case 17: return new AccountRequestLimitReachedException(status, headers, error); + case 21: return new PageMigratedException(status, headers, error); + case 32: return new PageRequestLimitReachedException(status, headers, error); // 100..199: graph method errors - case 100: return new UnsupportedGetRequestException(error); - case 102: return new UserAccessTokenRequiredException(error); - case 104: return new AccessTokenRequiredException(error); + case 100: return new UnsupportedGetRequestException(status, headers, error); + case 102: return new UserAccessTokenRequiredException(status, headers, error); + case 104: return new AccessTokenRequiredException(status, headers, error); // 200..299: permission errors case 200: case 201: @@ -175,39 +191,55 @@ public class GraphApiException extends RuntimeException case 296: case 297: case 298: - case 299: return new AuthorizationMissingException(error); + case 299: return new AuthorizationMissingException(status, headers, error); // 200..299: permission errors // 300..399: data editing errors ? - case 341: return new TemporaryRateLimitExceededException(error); + case 341: return new TemporaryRateLimitExceededException(status, headers, error); // 400..449: authentication error // 450..499: session errors // 500..599: application messaging errors ? - case 506: return new MultipleConcurrentPostsException(error); + case 506: return new MultipleConcurrentPostsException(status, headers, error); // 600..699: FQL errors - case 613: return new CustomRequestLimitReachedException(error); + case 613: return new CustomRequestLimitReachedException(status, headers, error); // 700..749: ref errors // 750..799: application integration errors // 900..949: application information errors // 950..999: batch api errors // 1000..1099: event api errors // 1100..1199: live-message errors - case 1609005: return new LinkPostFailureException(error); - case 2200: return new CallbackVerificationFailedException(error); + case 1609005: return new LinkPostFailureException(status, headers, error); + case 2200: return new CallbackVerificationFailedException(status, headers, error); default: LOG.info("unmapped error: {}", error); - return new UnmappedErrorException(error); + return new UnmappedErrorException(status, headers, error); } } - protected GraphApiException(FacebookErrorMessage error) + protected GraphApiException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { super(error.message); + this.status = status; + this.headers = headers; this.error = error; } + public HttpStatus getStatus() + { + return status; + } + + public HttpHeaders getHeaders() + { + return headers; + } + public Type getType() { return error.type == null ? null : Type.valueOf(error.type); diff --git a/src/main/java/de/juplo/facebook/errors/GraphMethodException.java b/src/main/java/de/juplo/facebook/errors/GraphMethodException.java index afe83cb..42dc23f 100644 --- a/src/main/java/de/juplo/facebook/errors/GraphMethodException.java +++ b/src/main/java/de/juplo/facebook/errors/GraphMethodException.java @@ -1,6 +1,11 @@ package de.juplo.facebook.errors; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + + + /** * Baseclass for exceptions of type {@code GraphMethodException}. @@ -8,8 +13,12 @@ package de.juplo.facebook.errors; */ public abstract class GraphMethodException extends GraphApiException { - GraphMethodException(FacebookErrorMessage error) + GraphMethodException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { - super(error); + super(status, headers, error); } } diff --git a/src/main/java/de/juplo/facebook/errors/LinkPostFailureException.java b/src/main/java/de/juplo/facebook/errors/LinkPostFailureException.java index 7169861..0039a53 100644 --- a/src/main/java/de/juplo/facebook/errors/LinkPostFailureException.java +++ b/src/main/java/de/juplo/facebook/errors/LinkPostFailureException.java @@ -1,6 +1,11 @@ package de.juplo.facebook.errors; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + + + /** * 1609005: Failure while posting link (data could not be read from link) @@ -9,8 +14,12 @@ package de.juplo.facebook.errors; */ public class LinkPostFailureException extends OAuthException { - protected LinkPostFailureException(FacebookErrorMessage error) + protected LinkPostFailureException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { - super(error); + super(status, headers, error); } } diff --git a/src/main/java/de/juplo/facebook/errors/MultipleConcurrentPostsException.java b/src/main/java/de/juplo/facebook/errors/MultipleConcurrentPostsException.java index b99bed7..8fd50b0 100644 --- a/src/main/java/de/juplo/facebook/errors/MultipleConcurrentPostsException.java +++ b/src/main/java/de/juplo/facebook/errors/MultipleConcurrentPostsException.java @@ -1,6 +1,11 @@ package de.juplo.facebook.errors; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + + + /** * 506: Multiple concurrent posts @@ -9,8 +14,12 @@ package de.juplo.facebook.errors; */ public class MultipleConcurrentPostsException extends OAuthException { - protected MultipleConcurrentPostsException(FacebookErrorMessage error) + protected MultipleConcurrentPostsException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { - super(error); + super(status, headers, error); } } diff --git a/src/main/java/de/juplo/facebook/errors/OAuth2GraphApiErrorHandler.java b/src/main/java/de/juplo/facebook/errors/OAuth2GraphApiErrorHandler.java index a0b5e45..9158987 100644 --- a/src/main/java/de/juplo/facebook/errors/OAuth2GraphApiErrorHandler.java +++ b/src/main/java/de/juplo/facebook/errors/OAuth2GraphApiErrorHandler.java @@ -7,7 +7,6 @@ import org.springframework.http.HttpStatus; import org.springframework.http.client.ClientHttpResponse; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.security.oauth2.client.http.OAuth2ErrorHandler; -import org.springframework.web.client.ResponseErrorHandler; diff --git a/src/main/java/de/juplo/facebook/errors/OAuthException.java b/src/main/java/de/juplo/facebook/errors/OAuthException.java index 4153dbc..ca672bc 100644 --- a/src/main/java/de/juplo/facebook/errors/OAuthException.java +++ b/src/main/java/de/juplo/facebook/errors/OAuthException.java @@ -1,6 +1,11 @@ package de.juplo.facebook.errors; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + + + /** * Baseclass for exceptions of type {@code OAuthException}. @@ -8,8 +13,12 @@ package de.juplo.facebook.errors; */ public class OAuthException extends GraphApiException { - protected OAuthException(FacebookErrorMessage error) + protected OAuthException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { - super(error); + super(status, headers, error); } } diff --git a/src/main/java/de/juplo/facebook/errors/PageMigratedException.java b/src/main/java/de/juplo/facebook/errors/PageMigratedException.java index c339d83..3c7ee01 100644 --- a/src/main/java/de/juplo/facebook/errors/PageMigratedException.java +++ b/src/main/java/de/juplo/facebook/errors/PageMigratedException.java @@ -3,6 +3,8 @@ package de.juplo.facebook.errors; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; @@ -18,9 +20,13 @@ public class PageMigratedException extends OAuthException private final Long oldId, newId; - protected PageMigratedException(FacebookErrorMessage error) + protected PageMigratedException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { - super(error); + super(status, headers, error); Matcher matcher = pattern.matcher(error.message); if (!matcher.find()) { diff --git a/src/main/java/de/juplo/facebook/errors/PageRequestLimitReachedException.java b/src/main/java/de/juplo/facebook/errors/PageRequestLimitReachedException.java index e4ee191..23c2bca 100644 --- a/src/main/java/de/juplo/facebook/errors/PageRequestLimitReachedException.java +++ b/src/main/java/de/juplo/facebook/errors/PageRequestLimitReachedException.java @@ -1,6 +1,11 @@ package de.juplo.facebook.errors; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + + + /** * 32: Account request limit reached. @@ -9,8 +14,12 @@ package de.juplo.facebook.errors; */ public class PageRequestLimitReachedException extends OAuthException { - protected PageRequestLimitReachedException(FacebookErrorMessage error) + protected PageRequestLimitReachedException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { - super(error); + super(status, headers, error); } } diff --git a/src/main/java/de/juplo/facebook/errors/TemporaryRateLimitExceededException.java b/src/main/java/de/juplo/facebook/errors/TemporaryRateLimitExceededException.java index 0eba617..e87d5b7 100644 --- a/src/main/java/de/juplo/facebook/errors/TemporaryRateLimitExceededException.java +++ b/src/main/java/de/juplo/facebook/errors/TemporaryRateLimitExceededException.java @@ -1,6 +1,11 @@ package de.juplo.facebook.errors; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + + + /** * 341: Temporary rate-limit excession because of server-failure or throtteling @@ -9,8 +14,12 @@ package de.juplo.facebook.errors; */ public class TemporaryRateLimitExceededException extends OAuthException { - protected TemporaryRateLimitExceededException(FacebookErrorMessage error) + protected TemporaryRateLimitExceededException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { - super(error); + super(status, headers, error); } } diff --git a/src/main/java/de/juplo/facebook/errors/UnexpectedErrorException.java b/src/main/java/de/juplo/facebook/errors/UnexpectedErrorException.java index 72c071b..2278e57 100644 --- a/src/main/java/de/juplo/facebook/errors/UnexpectedErrorException.java +++ b/src/main/java/de/juplo/facebook/errors/UnexpectedErrorException.java @@ -1,6 +1,11 @@ package de.juplo.facebook.errors; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + + + /** * 2: An unexpected error has occurred. @@ -8,8 +13,12 @@ package de.juplo.facebook.errors; */ public class UnexpectedErrorException extends OAuthException { - protected UnexpectedErrorException(FacebookErrorMessage error) + protected UnexpectedErrorException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { - super(error); + super(status, headers, error); } } diff --git a/src/main/java/de/juplo/facebook/errors/UnknownErrorException.java b/src/main/java/de/juplo/facebook/errors/UnknownErrorException.java index 7f5e8ff..4115f7b 100644 --- a/src/main/java/de/juplo/facebook/errors/UnknownErrorException.java +++ b/src/main/java/de/juplo/facebook/errors/UnknownErrorException.java @@ -1,6 +1,11 @@ package de.juplo.facebook.errors; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + + + /** * 1: An unknown error has occurred. @@ -8,8 +13,12 @@ package de.juplo.facebook.errors; */ public class UnknownErrorException extends OAuthException { - protected UnknownErrorException(FacebookErrorMessage error) + protected UnknownErrorException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { - super(error); + super(status, headers, error); } } diff --git a/src/main/java/de/juplo/facebook/errors/UnmappedErrorException.java b/src/main/java/de/juplo/facebook/errors/UnmappedErrorException.java index 839de09..997f53f 100644 --- a/src/main/java/de/juplo/facebook/errors/UnmappedErrorException.java +++ b/src/main/java/de/juplo/facebook/errors/UnmappedErrorException.java @@ -1,6 +1,11 @@ package de.juplo.facebook.errors; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + + + /** * Marker class for error-messages, that are not mapped yet. @@ -11,8 +16,12 @@ package de.juplo.facebook.errors; */ public class UnmappedErrorException extends GraphApiException { - protected UnmappedErrorException(FacebookErrorMessage error) + protected UnmappedErrorException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { - super(error); + super(status, headers, error); } } diff --git a/src/main/java/de/juplo/facebook/errors/UnsupportedGetRequestException.java b/src/main/java/de/juplo/facebook/errors/UnsupportedGetRequestException.java index 4a5a9b8..74f82f8 100644 --- a/src/main/java/de/juplo/facebook/errors/UnsupportedGetRequestException.java +++ b/src/main/java/de/juplo/facebook/errors/UnsupportedGetRequestException.java @@ -1,6 +1,11 @@ package de.juplo.facebook.errors; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + + + /** * 100: Unsupported get request. @@ -8,8 +13,12 @@ package de.juplo.facebook.errors; */ public class UnsupportedGetRequestException extends GraphMethodException { - protected UnsupportedGetRequestException(FacebookErrorMessage error) + protected UnsupportedGetRequestException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { - super(error); + super(status, headers, error); } } diff --git a/src/main/java/de/juplo/facebook/errors/UserAccessTokenRequiredException.java b/src/main/java/de/juplo/facebook/errors/UserAccessTokenRequiredException.java index cb91950..0d3a909 100644 --- a/src/main/java/de/juplo/facebook/errors/UserAccessTokenRequiredException.java +++ b/src/main/java/de/juplo/facebook/errors/UserAccessTokenRequiredException.java @@ -1,6 +1,11 @@ package de.juplo.facebook.errors; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + + + /** * A user access token is required to request this resource. @@ -8,8 +13,12 @@ package de.juplo.facebook.errors; */ public class UserAccessTokenRequiredException extends OAuthException { - public UserAccessTokenRequiredException(FacebookErrorMessage error) + public UserAccessTokenRequiredException( + HttpStatus status, + HttpHeaders headers, + FacebookErrorMessage error + ) { - super(error); + super(status, headers, error); } } -- 2.20.1