Use Utils.toString(Throwable) throughout

parent 9bc90956
......@@ -21,7 +21,6 @@ import edu.mit.csail.sdg.alloy4.A4Reporter;
import edu.mit.csail.sdg.alloy4.ConstList;
import edu.mit.csail.sdg.alloy4.Err;
import edu.mit.csail.sdg.alloy4.ErrorWarning;
import edu.mit.csail.sdg.alloy4.MailBug;
import edu.mit.csail.sdg.ast.Sig;
import edu.mit.csail.sdg.parser.CompModule;
import edu.mit.csail.sdg.parser.CompUtil;
......@@ -119,7 +118,7 @@ public final class Mut extends CatalystCommand implements Runnable {
.forEach(p -> cr.file_results.add(analyzeFile(corpus, p, i.getAndIncrement(), cr.file_count)));
} catch (Exception e) {
String msg = "Failed while trying to iterate through and analyze " + corpus + " models.";
cr.error = String.format("%s%n%s", msg, MailBug.dump(e));
cr.error = String.format("%s%n%s", msg, Utils.toString(e));
System.out.print(cr.error);
throw Utils.systemExit(1);
}
......@@ -156,10 +155,11 @@ public final class Mut extends CatalystCommand implements Runnable {
try {
world = CompUtil.parseEverything_fromFile(rep, null, fr.file_name);
} catch (Err e) {
String msg = "Error in parsing or type checking. Stack trace from the exception:",
err = e.dump();
String
msg = "Error in parsing or type checking. Stack trace from the exception:",
err = Utils.toString(e);
pln(progress + "error: " + fr.file_name);
fr.errors.add(new ParseOrTypeError(String.format("%s%n%s", msg, e.dump()), true));
fr.errors.add(new ParseOrTypeError(String.format("%s%n%s", msg, err), true));
errorCount.getAndIncrement();
return fr;
}
......@@ -168,10 +168,11 @@ public final class Mut extends CatalystCommand implements Runnable {
try {
fr.mutation_results.add(mutateModule(world, MutationKind.ORIGINAL));
} catch (Err e) {
String msg = "Error while analyzing original module. Stack trace from the exception:",
err = e.dump();
String
msg = "Error while analyzing original module. Stack trace from the exception:",
err = Utils.toString(e);
pln(progress + "error: " + fr.file_name);
fr.errors.add(new ParseOrTypeError(String.format("%s%n%s", msg, e.dump()), true));
fr.errors.add(new ParseOrTypeError(String.format("%s%n%s", msg, err), true));
errorCount.getAndIncrement();
return fr;
}
......@@ -181,10 +182,11 @@ public final class Mut extends CatalystCommand implements Runnable {
try {
fr.mutation_results.add(mutateModule(world, MutationKind.MUT_RANDOM));
} catch (Err e) {
String msg = "Error while analyzing mutation. Stack trace from the exception:",
err = e.dump();
String
msg = "Error while analyzing mutation. Stack trace from the exception:",
err = Utils.toString(e);
pln(progress + "error: " + fr.file_name);
fr.errors.add(new ParseOrTypeError(String.format("%s%n%s", msg, e.dump()), true));
fr.errors.add(new ParseOrTypeError(String.format("%s%n%s", msg, err), true));
errorCount.getAndIncrement();
return fr;
}
......
......@@ -18,11 +18,11 @@ import com.google.gson.GsonBuilder;
import edu.mit.csail.sdg.alloy4.A4Reporter;
import edu.mit.csail.sdg.alloy4.Err;
import edu.mit.csail.sdg.alloy4.ErrorWarning;
import edu.mit.csail.sdg.alloy4.MailBug;
import edu.mit.csail.sdg.parser.CompModule;
import edu.mit.csail.sdg.parser.CompUtil;
import picocli.CommandLine.Command;
@Command(name = "ssr", description = "Structure Signature Removal mode")
public final class SSR extends CatalystCommand implements Runnable {
final transient private String
......@@ -76,7 +76,7 @@ public final class SSR extends CatalystCommand implements Runnable {
.forEach(p -> cr.file_results.add(analyzeFile(corpus, p, i.getAndIncrement(), cr.file_count)));
} catch (Exception e) {
String msg = "Failed while trying to iterate through and analyze " + corpus + " models.";
cr.error = String.format("%s%n%s", msg, MailBug.dump(e));
cr.error = String.format("%s%n%s", msg, Utils.toString(e));
System.out.print(cr.error);
throw Utils.systemExit(1);
}
......@@ -124,10 +124,11 @@ public final class SSR extends CatalystCommand implements Runnable {
try {
world = CompUtil.parseEverything_fromFile(rep, null, fr.file_name);
} catch (Err e) {
String msg = "Error in parsing or type checking. Stack trace from the exception:",
err = e.dump();
String
msg = "Error in parsing or type checking. Stack trace from the exception:",
err = Utils.toString(e);
pln(progress + "error: " + fr.file_name);
fr.errors.add(new ParseOrTypeError(String.format("%s%n%s", msg, e.dump()), true));
fr.errors.add(new ParseOrTypeError(String.format("%s%n%s", msg, err), true));
errorCount.getAndIncrement();
return fr;
}
......
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