--- /dev/null
+package de.juplo.facebook;
+
+import java.io.IOException;
+import java.util.Map.Entry;
+import org.codehaus.jackson.JsonGenerator;
+import org.codehaus.jackson.JsonProcessingException;
+import org.codehaus.jackson.map.JsonSerializer;
+import org.codehaus.jackson.map.SerializerProvider;
+
+/**
+ * @author Dave Syer
+ *
+ */
+public class GraphApiExceptionJackson1Serializer extends JsonSerializer<GraphApiException> {
+
+ @Override
+ public void serialize(GraphApiException value, JsonGenerator jgen, SerializerProvider provider) throws IOException,
+ JsonProcessingException {
+ jgen.writeStartObject();
+ jgen.writeStringField("error", value.getOAuth2ErrorCode());
+ jgen.writeStringField("error_description", value.getMessage());
+ if (value.getAdditionalInformation()!=null) {
+ for (Entry<String, String> entry : value.getAdditionalInformation().entrySet()) {
+ String key = entry.getKey();
+ String add = entry.getValue();
+ jgen.writeStringField(key, add);
+ }
+ }
+ jgen.writeEndObject();
+ }
+
+}