mirror of https://github.com/sbt/sbt.git
preserve IOException type when translating exceptions. fixes #253
This commit is contained in:
parent
8beb823a9b
commit
30bdcf68d4
|
|
@ -7,7 +7,10 @@ object ErrorHandling
|
||||||
{
|
{
|
||||||
def translate[T](msg: => String)(f: => T) =
|
def translate[T](msg: => String)(f: => T) =
|
||||||
try { f }
|
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] =
|
def wideConvert[T](f: => T): Either[Throwable, T] =
|
||||||
try { Right(f) }
|
try { Right(f) }
|
||||||
|
|
@ -31,7 +34,8 @@ object ErrorHandling
|
||||||
else
|
else
|
||||||
e.toString
|
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
|
override def toString = msg
|
||||||
}
|
}
|
||||||
|
final class TranslatedIOException private[sbt](msg: String, cause: IOException) extends TranslatedException(msg, cause)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue