diff --git a/util/control/ErrorHandling.scala b/util/control/ErrorHandling.scala index a346e0d14..caf653da1 100644 --- a/util/control/ErrorHandling.scala +++ b/util/control/ErrorHandling.scala @@ -7,7 +7,10 @@ object ErrorHandling { def translate[T](msg: => String)(f: => T) = try { f } - catch { case e: Exception => throw new TranslatedException(msg + e.toString, e) } + catch { + case e: IOException => throw new TranslatedIOException(msg + e.toString, e) + case e: Exception => throw new TranslatedException(msg + e.toString, e) + } def wideConvert[T](f: => T): Either[Throwable, T] = try { Right(f) } @@ -31,7 +34,8 @@ object ErrorHandling else e.toString } -final class TranslatedException private[sbt](msg: String, cause: Throwable) extends RuntimeException(msg, cause) +sealed class TranslatedException private[sbt](msg: String, cause: Throwable) extends RuntimeException(msg, cause) { override def toString = msg -} \ No newline at end of file +} +final class TranslatedIOException private[sbt](msg: String, cause: IOException) extends TranslatedException(msg, cause)