Between Tuesday August 20th, 5:00pm and Thursday August 22nd, 8:00am git.uwaterloo.ca will be down for an upgrade to version 10.8.7.

e48b11aa by Amin Bandali

Use Utils.toString(Throwable) throughout

1 parent 9bc90956
......@@ -21,7 +21,6 @@
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 @@ protected final CorpusResult analyzeCorpus(String corpus) {
.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 void warning(ErrorWarning msg) {
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 void warning(ErrorWarning msg) {
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 void warning(ErrorWarning msg) {
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 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 @@ protected final CorpusResult analyzeCorpus(String corpus) {
.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 void warning(ErrorWarning msg) {
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;
}
......