From b09c35457e3e66dd94b186505408ea87be709ce9 Mon Sep 17 00:00:00 2001 From: Dan Holmsand Date: Sun, 9 Feb 2014 12:42:51 +0100 Subject: [PATCH] Improve error message for invalid Hiccup forms --- src/reagent/impl/template.cljs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/reagent/impl/template.cljs b/src/reagent/impl/template.cljs index ae4f388..61408f5 100644 --- a/src/reagent/impl/template.cljs +++ b/src/reagent/impl/template.cljs @@ -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