From d1ad850a1227971aa03066bb40c67fc4c6d1b812 Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Mon, 30 May 2011 22:10:01 -0400 Subject: [PATCH] error handling adjustments, including showing failing task in red (for #29) --- util/control/ErrorHandling.scala | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/util/control/ErrorHandling.scala b/util/control/ErrorHandling.scala index 4072edff3..a346e0d14 100644 --- a/util/control/ErrorHandling.scala +++ b/util/control/ErrorHandling.scala @@ -21,6 +21,15 @@ object ErrorHandling def convert[T](f: => T): Either[Exception, T] = try { Right(f) } catch { case e: Exception => Left(e) } + + def reducedToString(e: Throwable): String = + if(e.getClass == classOf[RuntimeException]) + { + val msg = e.getMessage + if(msg == null || msg.isEmpty) e.toString else msg + } + else + e.toString } final class TranslatedException private[sbt](msg: String, cause: Throwable) extends RuntimeException(msg, cause) {