   (:clj
    [(:require
      [active.clojure.lens :as lens]
+     [active.clojure.condition :as c]
      [active.clojure.macro :refer [if-cljs]])]
    :cljs
    [(:require
      [active.clojure.lens :as lens]
+     [active.clojure.condition :as c])
     (:require-macros [active.clojure.macro :refer [if-cljs]])]))
+
+(defn throw-illegal-argument-exception
+  [msg]
+  (c/assertion-violation `throw-illegal-argument-exception "Illegal argument" msg))
 
 ;; Only needed in ClojureScript, does nothing in Clojure
 (defn check-type

    (let [?field-names-set (set ?field-names)]
      (doseq [?constructor-arg ?constructor-args]
        (when-not (contains? ?field-names-set ?constructor-arg)
          (throw (IllegalArgumentException. (str "constructor argument " ?constructor-arg " is not a field in " *ns* " " (meta &form)))))))

    `(do
       (defrecord ~?type

                              (do
                                (when-not (and (= 3 (count spec))
                                               (every? symbol spec))
                                  (throw-illegal-argument-exception (str "invalid field spec " spec " in " *ns* " " (meta &form))))
                                (recur (rest specs) (list* spec triples)))

                              (symbol? spec)
                              (do
                                (when (empty? (rest specs))
                                  (throw (throw-illegal-argument-exception (str "incomplete field spec for " spec " in " *ns* " " (meta &form)))))
                                (when-not (symbol? (fnext specs))
                                  (throw (throw-illegal-argument-exception (str "invalid accessor " (fnext specs) " for " spec " in " *ns* " " (meta &form)))))
                                (recur (nnext specs)
                                       (list* [spec (fnext specs) nil] triples)))

                              :else
                              (throw (throw-illegal-argument-exception (str "invalid field spec " spec " in " *ns* " " (meta &form))))))))

        ?constructor (first ?constructor-call)
        ?constructor-args (rest ?constructor-call)
