Verified Commit 5c1ece66 authored by Amin Bandali's avatar Amin Bandali
Browse files

Print human-readable errors

parent d5e6d4eb
......@@ -35,6 +35,7 @@ import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
......@@ -43,7 +44,7 @@ import picocli.CommandLine.Option;
@Command(showDefaultValues = true)
public abstract class CatalystCommand {
protected transient Result r;
protected transient Gson gson;
protected transient Gson gson, gsonPretty;
protected transient AtomicInteger errorCount;
protected transient Writer wtxt, wjson, ejson;
protected transient PrintWriter ptxt;
......@@ -96,6 +97,7 @@ public abstract class CatalystCommand {
r.options = this;
r.results = new ArrayList<CorpusResult>();
gson = new Gson();
gsonPretty = new GsonBuilder().setPrettyPrinting().create();
errorCount = new AtomicInteger();
wtxt = setupWriter(outputTxtFile, true);
wjson = setupWriter(outputJsonFile, true);
......
......@@ -71,7 +71,7 @@ public final class SSR extends CatalystCommand implements Runnable {
pln(String.format("total elapsed time: %dms", r.total_elapsed_time));
writerWriteFlushClose(wjson, gson.toJson(r), oj);
writerWriteFlushClose(ejson, gson.toJson(errors), ej);
writerWriteFlushClose(ejson, gsonPretty.toJson(errors), ej);
ptxt.flush();
ptxt.close();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment