Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match errors are somewhat hidden behind more confusing error in worksheet mode #890

Open
Sporarum opened this issue Jun 30, 2023 · 0 comments

Comments

@Sporarum
Copy link

Describe the bug

Match errors (and possibly other errors) show up as a java.lang.ExceptionInInitializerError on class main

Scastie snippet link

https://scastie.scala-lang.org/MVyFPRGIRFGceTz2j49JKQ

To Reproduce

  1. Click Run
  2. The error should look like:
    java.lang.ExceptionInInitializerError
    	at Main$.<clinit>(main.scala:12)
    	at Main.main(main.scala)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    	at sbt.Run.invokeMain(Run.scala:143)
    	at sbt.Run.execute$1(Run.scala:93)
    	at sbt.Run.$anonfun$runWithLoader$5(Run.scala:120)
    	at sbt.Run$.executeSuccess(Run.scala:186)
    	at sbt.Run.runWithLoader(Run.scala:120)
    	at sbt.Run.run(Run.scala:127)
    	at com.olegych.scastie.sbtscastie.SbtScastiePlugin$$anon$1.$anonfun$run$1(SbtScastiePlugin.scala:38)
    	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
    	at sbt.util.InterfaceUtil$$anon$1.get(InterfaceUtil.scala:21)
    	at sbt.ScastieTrapExit$App.run(ScastieTrapExit.scala:258)
    	at java.base/java.lang.Thread.run(Thread.java:833)
    Caused by: scala.MatchError: 4 (of class java.lang.Integer)
    	at Playground$.f(main.scala:6)
    	at Playground$.<clinit>(main.scala:8)
    	... 17 more

Expected behavior

As a user, I see only what is in the text field, so for me there is no main class or initializer of such a class, therefore I expect to see the match error directly, with potentially it's call-stack

Screenshot ( Optional )

No response

Version

Scastie website

What browsers are you seeing the problem on?

Firefox

Relevant log output

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant