Skip to content

Error handling in cljx-compile #70

@undernorthernsky

Description

@undernorthernsky

Having this bug in project.clj:

:cljx {:builds [{ ; boring
                        :rules clj}]}

caused the rather unhelpful error:

$ lein cljx once
java.lang.NullPointerException
    at clojure.lang.Symbol.intern(Symbol.java:60)
    at clojure.core$symbol.invoke(core.clj:539)
    at cljx.core$cljx_compile.doInvoke(core.clj:85)
    at clojure.lang.RestFn.invoke(RestFn.java:410)
    at leiningen.cljx$once.invoke(cljx.clj:11)
    at leiningen.cljx$cljx.invoke(cljx.clj:33) ...

I do appreciate the freedom the fallback to resolving symbols in cljx-compile allows - but it causes a steep price for an average user (in a failure case like this).
A little more context (e.g. "NPE while trying to load namespace x") in the error message seems like a good idea.
Maybe even fuzzy checking to catch "clj" and "cljs" as strings / symbols and emit a "Did you actually mean what you wrote in the config?" message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions