Print a terse stack trace for unexpected errors.

This commit is contained in:
Natalie Weizenbaum 2016-10-19 14:53:46 -07:00
parent 1f4596ff6a
commit 0a8633735a

View File

@ -53,13 +53,23 @@ void main(List<String> args) {
if (options['trace']) {
stderr.writeln();
stderr.write(new Trace.from(stackTrace).toString());
stderr.write(new Trace.from(stackTrace).terse.toString());
stderr.flush();
}
// Exit code 65 indicates invalid data per
// http://www.freebsd.org/cgi/man.cgi?query=sysexits.
exit(65);
} catch (error, stackTrace) {
if (options['color']) stderr.write('\u001b[31m\u001b[1m');
stderr.write('Unexpected exception:');
if (options['color']) stderr.write('\u001b[0m');
stderr.writeln();
stderr.writeln(error);
stderr.writeln();
stderr.write(new Trace.from(stackTrace).terse.toString());
stderr.flush();
}
}