minor cleanup.
This commit is contained in:
@@ -46,31 +46,7 @@
|
||||
(assoc-in [:headers "hx-retarget"] "#modal-content")
|
||||
(assoc-in [:headers "hx-reswap"] "innerHTML"))))))
|
||||
|
||||
(defn wrap-error-response [handler]
|
||||
(fn [request]
|
||||
(try
|
||||
(handler request)
|
||||
(catch Exception e
|
||||
(if-let [v (or (:validation-error (ex-data e))
|
||||
(:validation-error (ex-data (.getCause e))))]
|
||||
|
||||
(do
|
||||
(alog/warn ::request-validation-error
|
||||
:exception e)
|
||||
(html-response
|
||||
[:div.notification.is-warning.is-light
|
||||
v]
|
||||
:status 400))
|
||||
(do
|
||||
(alog/error ::request-error
|
||||
:exception e)
|
||||
(when (= "dev" (:dd-env env))
|
||||
(println e))
|
||||
(html-response
|
||||
[:div.notification.is-danger.is-light
|
||||
"Server error occured."
|
||||
(ex-message e)]
|
||||
:status 500)))))))
|
||||
|
||||
|
||||
(defn form-data->map [form-data]
|
||||
(reduce-kv
|
||||
@@ -229,6 +205,7 @@
|
||||
query-schema
|
||||
query-params
|
||||
main-transformer)))
|
||||
|
||||
(catch Exception e
|
||||
(alog/warn ::validation-error :error e)
|
||||
(throw (ex-info (->> (-> e
|
||||
|
||||
Reference in New Issue
Block a user