error handling adjustments, including showing failing task in red (for #29)

This commit is contained in:
Mark Harrah 2011-05-30 22:10:01 -04:00
parent f0608da0a8
commit d1ad850a12
1 changed files with 9 additions and 0 deletions

View File

@ -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)
{