0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-25 07:58:49 -05:00

🐛 Set proper return value on validation error handler.

This commit is contained in:
Andrey Antukh 2021-12-28 23:19:29 +01:00 committed by Alonso Torres
parent f0e1bc1d59
commit 01c89f6554

View file

@ -55,17 +55,9 @@
(defmethod handle-exception :validation (defmethod handle-exception :validation
[err req] [err req]
(let [header (get-in req [:headers "accept"]) (let [edata (ex-data err)]
edata (ex-data err)] {:status 400
(if (and (= :spec-validation (:code edata)) :body (dissoc edata ::s/problems)}))
(str/starts-with? header "text/html"))
{:status 400
:headers {"content-type" "text/html"}
:body (str "<pre style='font-size:16px'>"
(:explain edata)
"</pre>\n")}
{:status 400
:body (dissoc edata ::s/problems)})))
(defmethod handle-exception :assertion (defmethod handle-exception :assertion
[error request] [error request]