🐛 Fix incorrect erorr reporting.

This commit is contained in:
Andrey Antukh 2020-12-10 21:51:48 +01:00 committed by Alonso Torres
parent 8f37f74d29
commit 01edf49de0
4 changed files with 24 additions and 8 deletions

View file

@ -29,19 +29,18 @@
(defmethod handle-exception :validation
[err req]
(let [header (get-in req [:headers "accept"])
edata (ex-data err)]
error (ex-data err)]
(cond
(and (str/starts-with? header "text/html")
(= :spec-validation (:code edata)))
(= :spec-validation (:code error)))
{:status 400
:headers {"content-type" "text/html"}
:body (str "<pre style='font-size:16px'>"
(with-out-str
(:data edata))
(:hint-verbose error)
"</pre>\n")}
:else
{:status 400
:body edata})))
:body error})))
(defmethod handle-exception :ratelimit
[_ _]

View file

@ -32,7 +32,6 @@
(defstate semaphore
:start (Semaphore. (:image-process-max-threads cfg/config 1)))
;; --- Generic specs
(s/def :internal.http.upload/filename ::us/string)