diff options
author | Paul Phillips <paulp@improving.org> | 2009-05-27 18:35:19 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-05-27 18:35:19 +0000 |
commit | b036f6fe74373bee058cf6cf85e482dc75c09fd9 (patch) | |
tree | 278fc7ba74cee79bd67bf714cc715abd79b81261 | |
parent | 2039b7fec7b902e3cef0a9c31a94ea96c2e469c8 (diff) | |
download | scala-b036f6fe74373bee058cf6cf85e482dc75c09fd9.tar.gz scala-b036f6fe74373bee058cf6cf85e482dc75c09fd9.tar.bz2 scala-b036f6fe74373bee058cf6cf85e482dc75c09fd9.zip |
Put exception unwrapping back in interpreter as...
Put exception unwrapping back in interpreter as it wasn't actually
working.
-rw-r--r-- | src/compiler/scala/tools/nsc/Interpreter.scala | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala index 453f96120e..123ed92a66 100644 --- a/src/compiler/scala/tools/nsc/Interpreter.scala +++ b/src/compiler/scala/tools/nsc/Interpreter.scala @@ -765,8 +765,14 @@ class Interpreter(val settings: Settings, out: PrintWriter) val resultValMethod: reflect.Method = resultObject getMethod "result" lazy val pair = (resultValMethod.invoke(resultObject).toString, true) + def unwrap(e: Throwable): Throwable = e match { + case (_: InvocationTargetException | _: ExceptionInInitializerError) if e.getCause ne null => + unwrap(e.getCause) + case _ => e + } + (reflectionUnwrapper either pair) match { - case Left(e) => (stringFrom(e.printStackTrace(_)), false) + case Left(e) => (stringFrom(unwrap(e).printStackTrace(_)), false) case Right((res, success)) => (res, success) } } |