Def of var with a ns that doesn't exist will yield this error:
Cause: Compiler.lookupVar() returns null if the ns in a qualified var does not exist yet.
Proposed: The error message would be improved by naming the symbol and throwing a CompilerException with file/line/col info. It's not obvious, but this may be the only case where this error occurs. If so, the error message could be more specific that the ns is the part that doesn't exist.
Screened by: Alex Miller
(properly named patch)
You could throw a CompilerException with the location of the problem instead (as the ticket description suggests).
Sorry, I should've mentioned because this wasn't obvious to me either (and in fact I forgot until just now): the RuntimeException is already caught and wrapped in a CompilerException.
I'm not sure which try-catch block within Compiler.java this is happening in, there are multiple. But you can see in the output that the exception is a CompilerException and the file|line|col info is there:
In the Repl...
...or in a source file
Also, at the point at which the RuntimeException of this patch is being thrown, the source line and col params to CompilerException are not available, or at least not afaict.
I'll follow up on this patch later - Rich thought it was making too many assumptions. I think we validated many of those but need to double-check those.
Updated error result as of Clojure 1.10. It is now throwing a :compile-syntax error phase exception with file/line/col too.