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:
parent
f0e1bc1d59
commit
01c89f6554
1 changed files with 3 additions and 11 deletions
|
@ -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]
|
||||||
|
|
Loading…
Add table
Reference in a new issue