mirror of
https://github.com/penpot/penpot.git
synced 2025-01-26 00:19:07 -05:00
✨ More tweaks on the error reporter.
This commit is contained in:
parent
a8a6882708
commit
a633ed3c9a
1 changed files with 8 additions and 7 deletions
|
@ -33,16 +33,17 @@
|
||||||
|
|
||||||
:spec-problems (some->> data ::s/problems (take 10) seq vec)
|
:spec-problems (some->> data ::s/problems (take 10) seq vec)
|
||||||
:spec-value (some->> data ::s/value)
|
:spec-value (some->> data ::s/value)
|
||||||
:spec-explain (binding [s/*explain-out* expound/printer]
|
:data (some-> data (dissoc ::s/problems ::s/value ::s/spec))
|
||||||
(with-out-str
|
|
||||||
(s/explain-out (update data ::s/problems #(take 10 %)))))
|
|
||||||
|
|
||||||
:data (some-> data (dissoc ::s/problems ::s/value :hint))
|
|
||||||
:ip-addr (parse-client-ip request)
|
:ip-addr (parse-client-ip request)
|
||||||
:profile-id (:profile-id request)}
|
:profile-id (:profile-id request)}
|
||||||
(let [headers (:headers request)]
|
(let [headers (:headers request)]
|
||||||
{:user-agent (get headers "user-agent")
|
{:user-agent (get headers "user-agent")
|
||||||
:frontend-version (get headers "x-frontend-version" "unknown")}))))
|
:frontend-version (get headers "x-frontend-version" "unknown")})
|
||||||
|
|
||||||
|
(when (and data (::s/problems data))
|
||||||
|
{:spec-explain (binding [s/*explain-out* expound/printer]
|
||||||
|
(with-out-str
|
||||||
|
(s/explain-out (update data ::s/problems #(take 10 %)))))}))))
|
||||||
|
|
||||||
(defmulti handle-exception
|
(defmulti handle-exception
|
||||||
(fn [err & _rest]
|
(fn [err & _rest]
|
||||||
|
@ -71,7 +72,7 @@
|
||||||
{:status 500
|
{:status 500
|
||||||
:body {:type :server-error
|
:body {:type :server-error
|
||||||
:code :assertion
|
:code :assertion
|
||||||
:data (dissoc edata ::s/problems ::s/value)}}))
|
:data (dissoc edata ::s/problems ::s/value ::s/spec)}}))
|
||||||
|
|
||||||
(defmethod handle-exception :not-found
|
(defmethod handle-exception :not-found
|
||||||
[err _]
|
[err _]
|
||||||
|
|
Loading…
Add table
Reference in a new issue