mirror of
https://github.com/sbt/sbt.git
synced 2026-10-08 02:53:10 +02:00
apply formatting
This commit is contained in:
@@ -7,20 +7,26 @@ import java.io.IOException
|
||||
|
||||
object ErrorHandling {
|
||||
def translate[T](msg: => String)(f: => T) =
|
||||
try { f } catch {
|
||||
try {
|
||||
f
|
||||
} 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) } catch {
|
||||
try {
|
||||
Right(f)
|
||||
} catch {
|
||||
case ex @ (_: Exception | _: StackOverflowError) => Left(ex)
|
||||
case err @ (_: ThreadDeath | _: VirtualMachineError) => throw err
|
||||
case x: Throwable => Left(x)
|
||||
}
|
||||
|
||||
def convert[T](f: => T): Either[Exception, T] =
|
||||
try { Right(f) } catch { case e: Exception => Left(e) }
|
||||
try {
|
||||
Right(f)
|
||||
} catch { case e: Exception => Left(e) }
|
||||
|
||||
def reducedToString(e: Throwable): String =
|
||||
if (e.getClass == classOf[RuntimeException]) {
|
||||
|
||||
Reference in New Issue
Block a user