Improve error message for invalid Hiccup forms

This commit is contained in:
Dan Holmsand 2014-02-09 12:42:51 +01:00
parent e32c3ad044
commit b09c35457e
1 changed files with 5 additions and 2 deletions

View File

@ -190,7 +190,6 @@
(if (keyword? tag)
(cached-wrapper tag)
(do
(assert (fn? tag))
(let [cached-class (.-cljsReactClass tag)]
(if-not (nil? cached-class)
cached-class
@ -199,7 +198,11 @@
(fn-to-class tag)))))))
(defn vec-to-comp [v level]
(assert (pos? (count v)))
(assert (pos? (count v)) "Hiccup form should not be empty")
(assert (let [tag (v 0)]
(or (keyword? tag)
(fn? tag)))
(str "Invalid Hiccup form: " (pr-str v)))
(let [props (get v 1)
c (as-class (v 0))
jsprops (js-obj cljs-argv v