tuned message;
authorwenzelm
Sat, 25 Aug 2018 20:10:49 +0200
changeset 68806 4597812d5182
parent 68805 57455c561849
child 68807 e28978310a2a
tuned message;
src/Pure/General/exn.scala
src/Pure/System/command_line.scala
--- a/src/Pure/General/exn.scala	Sat Aug 25 17:20:06 2018 +0200
+++ b/src/Pure/General/exn.scala	Sat Aug 25 20:10:49 2018 +0200
@@ -138,4 +138,10 @@
 
   def message(exn: Throwable): String =
     user_message(exn) getOrElse (if (is_interrupt(exn)) "Interrupt" else exn.toString)
+
+
+  /* trace */
+
+  def trace(exn: Throwable): String =
+    exn.getStackTrace.mkString("\n")
 }
--- a/src/Pure/System/command_line.scala	Sat Aug 25 17:20:06 2018 +0200
+++ b/src/Pure/System/command_line.scala	Sat Aug 25 20:10:49 2018 +0200
@@ -29,8 +29,7 @@
       try { body }
       catch {
         case exn: Throwable =>
-          if (debug) exn.printStackTrace
-          Output.error_message(Exn.message(exn))
+          Output.error_message(Exn.message(exn) + (if (debug) "\n" + Exn.trace(exn) else ""))
           Exn.return_code(exn, 2)
       }
     sys.exit(rc)