You'd want some middleware like this:
(defn with-error-catching [handler]
(catch Exception e ;; handle the exception
And then you'd use the decorate macro to add it onto your routes:
(decorate your-routes with-error-catching)
> You received this message because you are subscribed to the Google Groups "Compojure" group.
> To post to this group, send email to comp...@googlegroups.com.
> To unsubscribe from this group, send email to compojure+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/compojure?hl=en.
(catch Exception e
(if (= "development" environment)
(log :error e)
[500 "Application Error"]))))))
I have setup environments so that production doesn't produce a stack trace straight to the browser but development will.
On Jan 5, 2010, at 5:05 PM, James Reeves wrote: