diff --git a/lib/src/executable.dart b/lib/src/executable.dart index 98c2b10e..0b8d1f8d 100644 --- a/lib/src/executable.dart +++ b/lib/src/executable.dart @@ -53,13 +53,23 @@ void main(List 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(); } }