From b036f6fe74373bee058cf6cf85e482dc75c09fd9 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Wed, 27 May 2009 18:35:19 +0000 Subject: Put exception unwrapping back in interpreter as... Put exception unwrapping back in interpreter as it wasn't actually working. --- src/compiler/scala/tools/nsc/Interpreter.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') 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) } } -- cgit v1.2.3