X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Ffacebook%2Fexceptions%2FGraphApiException.java;h=375c5b855d5728d28d12601e39b84c8e1c66f590;hb=aa08a5cc575e5228c267686ba668cdbb3f361a90;hp=705caa46b1edd9832d6f8c5e486fa23120e48398;hpb=e90955777d96c9aa0f7f6827d13bbaae87075f06;p=facebook-utils diff --git a/src/main/java/de/juplo/facebook/exceptions/GraphApiException.java b/src/main/java/de/juplo/facebook/exceptions/GraphApiException.java index 705caa4..375c5b8 100644 --- a/src/main/java/de/juplo/facebook/exceptions/GraphApiException.java +++ b/src/main/java/de/juplo/facebook/exceptions/GraphApiException.java @@ -1,8 +1,5 @@ package de.juplo.facebook.exceptions; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRootName; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; @@ -22,6 +19,9 @@ import org.springframework.security.oauth2.common.exceptions.OAuth2Exception; */ public class GraphApiException extends OAuth2Exception { + public enum Type { OAuthException, GraphMethodException } + + final static Logger LOG = LoggerFactory.getLogger(GraphApiException.class); final static ObjectMapper OBJECT_MAPPER; @@ -96,9 +96,9 @@ public class GraphApiException extends OAuth2Exception } - public String getType() + public Type getType() { - return error.type; + return error.type == null ? null : Type.valueOf(error.type); } public Integer getCode() @@ -141,30 +141,4 @@ public class GraphApiException extends OAuth2Exception return e.getMessage(); } } - - - /** - * This class represents an error message from the Graph-API - * - * @see Graph-API Documentation - */ - @JsonRootName("error") - @JsonPropertyOrder({ "message", "type", "code", "error_subcode", "error_user_title", "error_user_msg", "fbtrace_id" }) - public static class FacebookErrorMessage - { - @JsonProperty("message") - String message; - @JsonProperty("type") - String type; - @JsonProperty("code") - Integer code; - @JsonProperty("error_subcode") - Integer subCode; - @JsonProperty("error_user_title") - String userTitle; - @JsonProperty("error_user_msg") - String userMessage; - @JsonProperty("fbtrace_id") - String traceId; - } }