File tree Expand file tree Collapse file tree 1 file changed +18
-8
lines changed
scala-console/src/main/scala-3/dotty/tools/repl Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ package dotty.tools.repl
33import dotty .tools .dotc .core .StdNames .str
44
55import java .io .PrintStream
6- import java .lang .reflect .Method
6+ import java .lang .reflect .{ InvocationTargetException , Method }
77import scala .annotation .tailrec
88import scala .util .control .NonFatal
99import scala .util .{Failure , Success , Try }
@@ -55,13 +55,23 @@ class SCIMain(out: PrintStream, loader: ClassLoader) {
5555 else
5656 SCResults .Success
5757 case Failure (ex) =>
58- if wasCausedByImageJMacroAbort(ex) then
59- out.println(s " WARNING: Detected ImageJ's \" $IMAGEJ_MACRO_CANCELED\" request. Stopping script execution. " )
60- SCResults .Success
61- else
62- // ex.printStackTrace()
63- // ex.printStackTrace(out)
64- SCResults .Error
58+ ex match {
59+ case ex1 if wasCausedByImageJMacroAbort(ex1) =>
60+ out.println(s " WARNING: Detected ImageJ's \" $IMAGEJ_MACRO_CANCELED\" request. Stopping script execution. " )
61+ SCResults .Success
62+ // Attempt to unwrap the exception that may be thrown in the interpreted scripts, skip the wrapping
63+ case e1 : InvocationTargetException =>
64+ e1.getCause match {
65+ case ex2 : ExceptionInInitializerError =>
66+ Option (ex2.getCause).foreach(_.printStackTrace(out))
67+ case _ =>
68+ // ???
69+ }
70+ SCResults .Error
71+ case _ =>
72+ // ???
73+ SCResults .Error
74+ }
6575 }
6676
6777 private def evalToMethod (script : String ): Option [Method ] = {
You can’t perform that action at this time.
0 commit comments