
com.algorithmia.development.SerializableException Maven / Gradle / Ivy
package com.algorithmia.development;
import com.google.gson.JsonObject;
import java.io.PrintWriter;
import java.io.StringWriter;
class SerializableException {
String message;
String stackTrace;
String errorType;
SerializableException(T e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
String exceptionAsString = sw.toString();
message = e.getMessage();
stackTrace = exceptionAsString;
errorType = e.getClass().toString();
}
String getJsonOutput() {
JsonObject node = new JsonObject();
node.addProperty("message", this.message);
node.addProperty("stacktrace", this.stackTrace);
node.addProperty("error_type", this.errorType);
return node.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy