tuned error messages;
authorwenzelm
Mon, 11 Jul 2011 23:15:27 +0200
changeset 43763 ab11dcfa3e6d
parent 43762 50ce6f602931
child 43765 24b8244d672b
tuned error messages;
src/Pure/library.scala
--- a/src/Pure/library.scala	Mon Jul 11 23:15:04 2011 +0200
+++ b/src/Pure/library.scala	Mon Jul 11 23:15:27 2011 +0200
@@ -20,14 +20,19 @@
 {
   /* user errors */
 
+  private val runtime_exception = Class.forName("java.lang.RuntimeException")
+
   object ERROR
   {
     def apply(message: String): Throwable = new RuntimeException(message)
     def unapply(exn: Throwable): Option[String] =
       exn match {
         case e: RuntimeException =>
-          val msg = e.getMessage
-          Some(if (msg == null) "Error" else msg)
+          if (e.getClass != runtime_exception) Some(e.toString)
+          else {
+            val msg = e.getMessage
+            Some(if (msg == null) "Error" else msg)
+          }
         case _ => None
       }
   }