X-Git-Url: https://juplo.de/gitweb/?p=facebook-errors;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Ffacebook%2FGraphApiException.java;fp=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Ffacebook%2FGraphApiException.java;h=0000000000000000000000000000000000000000;hp=18eaf81854df5ba71667b3f13f8ede834b65cfae;hb=bc0989ddb7bb05e2d95ae4aad4438b4d4806f9dc;hpb=80f6b663c648f011425b521e7c4185128a00149d diff --git a/src/main/java/de/juplo/facebook/GraphApiException.java b/src/main/java/de/juplo/facebook/GraphApiException.java deleted file mode 100644 index 18eaf81..0000000 --- a/src/main/java/de/juplo/facebook/GraphApiException.java +++ /dev/null @@ -1,62 +0,0 @@ -package de.juplo.facebook; - -import org.springframework.security.oauth2.common.exceptions.OAuth2Exception; - -/** - * Base exception for Facebook Graph-Api exceptions. - * - * @author Kai Moritz - */ -@org.codehaus.jackson.map.annotate.JsonDeserialize(using = GraphApiExceptionJackson1Deserializer.class) -@com.fasterxml.jackson.databind.annotation.JsonDeserialize(using = GraphApiExceptionJackson2Deserializer.class) -public class GraphApiException extends OAuth2Exception -{ - private final String type; - private final int code; - - private int httpErrorCode; - - - public GraphApiException(String message, String type, int code) - { - super(message); - this.type = type; - this.code = code; - } - - - public String getType() - { - return type; - } - - public int getCode() - { - return code; - } - - @Override - public int getHttpErrorCode() - { - return httpErrorCode == 0 ? super.getHttpErrorCode() : httpErrorCode; - } - - public void setHttpErrorCode(int httpErrorCode) - { - this.httpErrorCode = httpErrorCode; - } - - @Override - public String toString() - { - StringBuilder builder = new StringBuilder(); - builder.append("{error:{\"message\":\""); - builder.append(getMessage().replaceAll("\"", "\\\"")); - builder.append("\",\"type\":"); - builder.append(type.replaceAll("\"", "\\\"")); - builder.append("\",\"code\":"); - builder.append(code); - builder.append("}}"); - return builder.toString(); - } -}