diff options
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/ObjectRunner.scala | 7 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/ScriptRunner.scala | 8 |
2 files changed, 5 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/ObjectRunner.scala b/src/compiler/scala/tools/nsc/ObjectRunner.scala index 987a6b0ba0..16793996bb 100644 --- a/src/compiler/scala/tools/nsc/ObjectRunner.scala +++ b/src/compiler/scala/tools/nsc/ObjectRunner.scala @@ -9,6 +9,7 @@ package scala.tools.nsc import java.net.URL import util.ScalaClassLoader import java.lang.reflect.InvocationTargetException +import util.Exceptional.unwrap /** An object that runs another object specified by name. * @@ -37,10 +38,6 @@ object ObjectRunner { */ def runAndCatch(urls: List[URL], objectName: String, arguments: Seq[String]): Either[Throwable, Unit] = { try Right(run(urls, objectName, arguments)) - catch { - case e: ClassNotFoundException => Left(e) - case e: NoSuchMethodException => Left(e) - case e: InvocationTargetException => Left(e.getCause match { case null => e ; case cause => cause }) - } + catch { case e => Left(unwrap(e)) } } } diff --git a/src/compiler/scala/tools/nsc/ScriptRunner.scala b/src/compiler/scala/tools/nsc/ScriptRunner.scala index c432e1c9f0..c43542c348 100644 --- a/src/compiler/scala/tools/nsc/ScriptRunner.scala +++ b/src/compiler/scala/tools/nsc/ScriptRunner.scala @@ -19,6 +19,7 @@ import java.util.jar.{ JarEntry, JarOutputStream } import util.{ waitingForThreads, addShutdownHook } import scala.tools.util.PathResolver import scala.tools.nsc.reporters.{Reporter,ConsoleReporter} +import util.Exceptional.unwrap /** An object that runs Scala code in script files. * @@ -242,7 +243,7 @@ object ScriptRunner { val classpath = File(compiledLocation).toURL +: pr.asURLs ObjectRunner.runAndCatch(classpath, scriptMain(settings), scriptArgs) match { - case Left(ex) => Console println ex ; false + case Left(ex) => ex.printStackTrace() ; false case _ => true } } @@ -272,10 +273,7 @@ object ScriptRunner { scriptArgs: List[String]): Either[Throwable, Boolean] = { try Right(runScript(settings, scriptFile, scriptArgs)) - catch { - case e: IOException => Left(e) - case e: SecurityException => Left(e) - } + catch { case e => Left(unwrap(e)) } } /** Run a command |