mirror of
https://github.com/penpot/penpot.git
synced 2025-02-02 04:19:08 -05:00
🎉 Add global exception handler.
This commit is contained in:
parent
86936a66e0
commit
716490be26
1 changed files with 15 additions and 6 deletions
|
@ -92,12 +92,21 @@
|
|||
|
||||
(defmethod ig/init-key ::router
|
||||
[_ cfg]
|
||||
(rr/ring-handler
|
||||
(create-router cfg)
|
||||
(rr/routes
|
||||
(rr/create-resource-handler {:path "/"})
|
||||
(rr/create-default-handler))))
|
||||
|
||||
(let [handler (rr/ring-handler
|
||||
(create-router cfg)
|
||||
(rr/routes
|
||||
(rr/create-resource-handler {:path "/"})
|
||||
(rr/create-default-handler)))]
|
||||
(fn [request]
|
||||
(try
|
||||
(handler request)
|
||||
(catch Exception e
|
||||
(log/errorf e
|
||||
(str "Unhandled exception: " (ex-message e) "\n"
|
||||
"=| uri: " (pr-str (:uri request)) "\n"
|
||||
"=| method: " (pr-str (:request-method request)) "\n"))
|
||||
{:status 500
|
||||
:body "internal server error"})))))
|
||||
|
||||
(defn- create-router
|
||||
[{:keys [session rpc google-auth gitlab-auth github-auth metrics ldap-auth storage svgparse] :as cfg}]
|
||||
|
|
Loading…
Add table
Reference in a new issue