0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 08:50:57 -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
[err req]
(let [header (get-in req [:headers "accept"])
edata (ex-data err)]
(if (and (= :spec-validation (:code edata))
(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)})))
(let [edata (ex-data err)]
{:status 400
:body (dissoc edata ::s/problems)}))
(defmethod handle-exception :assertion
[error request]