Skip to content

Commit 9ec238f

Browse files
anmonteirodnolen
authored andcommitted
CLJS-1807: Better error messages for ns* calls
1 parent ec5ed67 commit 9ec238f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/clojure/cljs/analyzer.cljc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,7 +2183,7 @@
21832183
(defmethod parse 'ns
21842184
[_ env [_ name & args :as form] _ opts]
21852185
(when-not *allow-ns*
2186-
(throw (error env "Namespace declarations must be at the top-level.")))
2186+
(throw (error env "Namespace declarations must appear at the top-level.")))
21872187
(when-not (symbol? name)
21882188
(throw (error env "Namespaces must be named by a symbol.")))
21892189
(let [name (cond-> name (:macros-ns opts) macro-ns-name)]
@@ -2311,7 +2311,8 @@
23112311
(throw (error env (str "Arguments to " (name (first quoted-specs))
23122312
" must be quoted. Offending spec: " not-quoted))))
23132313
(when-not *allow-ns*
2314-
(throw (error env "Namespace declarations must be at the top-level.")))
2314+
(throw (error env (str "Calls to `" (name (first quoted-specs))
2315+
"` must appear at the top-level."))))
23152316
(let [specs (canonicalize-specs quoted-specs)
23162317
name (-> env :ns :name)
23172318
args (desugar-ns-specs

0 commit comments

Comments
 (0)