Thank you all for your answers, 

I like Marko's approach. 

What I had in mind, related to OP's post, would be a middleware that does
> (binding [*validation-failures* []] 
>    (handler req) 
>    (do-something-about *validation-failures*))
> There would be a global function, such as *add-failure*, which would *conj
> * a new failure to the vector.


Being a Clojure novice I had no idea that this was a possibility and it 
sounds like a better approach than exception throwing. Is this something 
similar to the way lib-noir does 
it? 
https://github.com/noir-clojure/lib-noir/blob/master/src/noir/validation.clj 
see the set-error fn. 

I would still code my own library because I am learning clojure at the 
moment. 
Question: how is it possible to guarantee that the *failure-list* or 
*error-list* is only available to the current request. Is that one of the 
properties of :dynamic?

On Wednesday, March 20, 2013 8:24:48 AM UTC-4, Marko Topolnik wrote:
>
> On Wednesday, March 20, 2013 1:06:54 PM UTC+1, Dave Sann wrote:
>
>> Marko, do you have a good example of doing what you say?
>>
>
> What I had in mind, related to OP's post, would be a middleware that does
>
> (binding [*validation-failures* []] 
>    (handler req) 
>    (do-something-about *validation-failures*))
>
> There would be a global function, such as *add-failure*, which would *conj
> * a new failure to the vector.
>
> -marko
>
>

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to