Some CompilerExceptions, especially ones that are thrown by evaluating the init expression of def forms, only contain the file name, not the file path.
For example, let's say you have a file that looks like:
(ns example.core1)
(def x (throw (ex-info "error!!" {})))
And load the namespace, then you'll see the CompilerException only contains the file name, instead of the file path:
user=> (require 'example.core1)
Execution error (ExceptionInfo) at example.core1/fn (core1.clj:3).
error!!
user=> (ex-data *e)
#:clojure.error{:phase :execution, :line 3, :column 8, :source "core1.clj"}
user=>
This is in contrast to other CompilerExceptions, which do contain the file path in their ex-data. For example, let's say you have another file that looks like:
(ns example.core2)
(no-such-function)
And then:
user=> (require 'example.core2)
Syntax error compiling at (example/core2.clj:3:1).
Unable to resolve symbol: no-such-function in this context
user=> (ex-data *e)
#:clojure.error{:phase :compile-syntax-check, :line 3, :column 1, :source "example/core2.clj"}
user=>
It seems that this difference comes from the fact that a DefExpr is constructed with SOURCE passed, instead of SOURCE_PATH.
It would be nice if CompilerExceptions always contain the file path (as far as possible), since it may be hard to identify the exact location where the exception occurred from only the file name.