cascade icon indicating copy to clipboard operation
cascade copied to clipboard

Confusing reporting of invalid template DSL

Open hlship opened this issue 16 years ago • 0 comments

I accidentally stripped off the leading ':' of a keyword (representing an element in the DSL). Took me a while to track down the error:

 Caused by: java.lang.RuntimeException: Incomplete parse of (:p {:class :c-exception-controls}   [:input {:type :checkbox, :id :omitted-toggle} " " :label {:for :omitted-toggle} ["Display hidden detail"]] ul {:class :c-exception-report} [(template-for [m (expand-exception-stack exception)] :li {:class (if (nil? (m :stack-trace)) :c-omitted)} [(render-exception-map m)])] (render-environment env)), 3 forms remain, starting with {:class :c-exception-report}.
at cascade.fail$fail__9.doInvoke(fail.clj:21)
at clojure.lang.RestFn.invoke(RestFn.java:460)
at cascade.internal.parser$run_parse__425.invoke(parser.clj:95)
at cascade.internal.viewbuilder$parse_embedded_template__517.invoke(viewbuilder.clj:112)
at cascade$template__429.doInvoke(cascade.clj:26)
at clojure.lang.RestFn.invoke(RestFn.java:522)
at clojure.lang.Var.invoke(Var.java:384)
at clojure.lang.AFn.applyToHelper(AFn.java:205)
at clojure.lang.Var.applyTo(Var.java:476)
at clojure.lang.Compiler.macroexpand1(Compiler.java:4485)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:4559)

First, having an explit error-catching case of a free-floating map inside the DSL might help, as would using meta-data to identify the source line more clearly.

hlship avatar Oct 22 '09 15:10 hlship