On Thu, Jul 26, 2012 at 10:19 PM, Takahiro Hozumi <fat...@googlemail.com> wrote:
> (when-let [m (validate params)]
>     (throw (clojure.lang.ExceptionInfo. "validation error" m)))
>
> (defn wrap-validation-exception [handler]
>   (fn [req]
>     (try
>       (handler req)
>       (catch clojure.lang.ExceptionInfo e
>         {:status 400
>          :headers {"Content-Type" "application/json"}
>          :body (some-json-generator (.getData e))}))))

Instead of calling the ExceptionInfo ctor & .getData directly, it's
better to use ex-info & ex-data instead.

Regards,
BG

-- 
Baishampayan Ghose
b.ghose at gmail.com

-- 
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

Reply via email to