Compiler.load() throws CompilerException without setting the phase, which then uses default, which is :compile-syntax-check.
Given a file that, on load, will trigger an execution error:
Loading it will report as a compile exception, even though it's not a compile error (also, the location is wrong as it points to the invoke at the end):
This case occurs particularly in Cursive, which wraps the eval'ed expression in a form that is loaded by Cursive, so all evals from within a source file have this issue.
Cause: The cause of this is in Compiler.load() - that code catches Throwable and wraps it in a CompilerException, using the original constructor which has a default phase in it.
Proposed: Both CompilerExceptions and runtime exceptions should just flow out of load. Error triage already knows how to handle both cases correctly.
Note: related tickets here are (which introduced some of this long ago) and (whose tests are changed in this patch). The latter improved some whitespace consuming in the reader and those are good but these patches were all papering symptoms - the error triage changes in 1.10 are taking care of making good messages now.
However, this does change the content of the raw exception flowing from this case (no longer getting a wrapped exception with ex-data) and that may impact tools like CIDER. In general, tools should be using error triage dath from something like (-> e Throwable->map clojure.main/ex-triage). That call will return necessary source and line info.
After, the error is execution, not compilation and it points to the line that actually caused the exception:
-2 patch is missing, I will look at this again
I think is same problem as this.