Hey Leonardo, There's a critical bug in 0.2.2-RC1 in the bouncers.core/wrap function. An IllegalArgumentException is triggered whenever a validator is not passed an explicit :message field. It looks like this was introduced in the process of trying to allow validators to take an arbitrary number of input args (a very good thing IMO). Here's a minimum case for replicating this error at your repl:
(let [{:keys [message] :or {message "foo"}} '()] message) IllegalArgumentException No value supplied for key: null clojure.lang.PersistentHashMap.create (PersistentHashMap.java:77) This is being triggered in your wrap function when you apply map destructuring to the right-hand result of (split-with (complement keyword?) args). Anyway, here is a patched version of wrap that should fix the problem. FWIW, I also fixed the docstring typo "erros" -> "errors". (defn wrap "Wraps pred in the context of validating a single value - `acc` is the map being validated - `pred` is a validator - `k` the path to the value to be validated in the associative structure acc - `args` any extra args to pred It only runs pred if: - the validator is optional *and* there is a non-nil value to be validated (this information is read from pred's metadata) - there are no previous errors for the given path Returns `acc` augmented with a namespace qualified ::errors keyword " [acc [pred k & args]] (let [pred (h/resolve-or-same pred) k (if (vector? k) k [k]) error-path (cons ::errors k) {:keys [default-message-format optional]} (meta pred) [args message-kv] (split-with (complement keyword?) args) message (get (apply hash-map message-kv) :message default-message-format) pred-subject (get-in acc k)] (if (or (and optional (nil? pred-subject)) (not (empty? (get-in acc error-path))) (apply pred pred-subject args)) acc (update-in acc error-path #(conj % (format message (name (peek k)))))))) Cheers, ~Gary On Sunday, January 13, 2013 8:03:36 PM UTC-5, Leonardo Borges wrote: > > Thanks, really appreciate the kind words. > > I just pushed [bouncer "0.2.2-RC1"] so feel free to give that a go :) > > Cheers, > Leo > > Leonardo Borges > www.leonardoborges.com > > > On Fri, Jan 11, 2013 at 3:44 PM, faenvie <fanny....@gmx.de > <javascript:>>wrote: > >> >> i took a look at it. bouncers DSL seems smart inside and out. >> Has an excellent Documentation too. Thanks for sharing it. >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@googlegroups.com<javascript:> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+u...@googlegroups.com <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en