use of com.serotonin.json.convert.ThrowableSerializingConverter in project ma-core-public by infiniteautomation.
the class ExceptionTest method main.
public static void main(String[] args) throws Exception {
JsonContext context = new JsonContext();
context.addConverter(new ThrowableSerializingConverter(), Throwable.class);
StringWriter out = new StringWriter();
JsonWriter writer = new JsonWriter(context, out);
writer.setPrettyOutput(true);
writer.writeObject(createException1());
System.out.println(out);
JsonReader reader = new JsonReader(context, out.toString());
Throwable t = reader.read(Throwable.class);
System.out.println("Great success!");
System.out.println(t.getMessage());
t.printStackTrace();
}
Aggregations