On Wednesday, March 20, 2013 5:51:59 PM UTC+1, Julien Dreux wrote:

> 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.cljsee
>  the set-error fn. 
>

Hm, that's really it, quite precisely; I wasn't aware of it. Seeing it now 
I realize that in my example I made the mistake of forgetting to wrap the 
failure vector inside an atom. Without that it won't work. 

-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