mirror of
https://github.com/penpot/penpot.git
synced 2025-05-23 23:46:11 +02:00
🐛 Minor fix on error reporting.
This commit is contained in:
parent
c5f4ae2242
commit
9c73444102
2 changed files with 20 additions and 14 deletions
|
@ -17,13 +17,14 @@
|
||||||
|
|
||||||
|
|
||||||
(defn get-context-string
|
(defn get-context-string
|
||||||
[err request]
|
[request edata]
|
||||||
(str
|
(str "=| uri: " (pr-str (:uri request)) "\n"
|
||||||
"=| uri: " (pr-str (:uri request)) "\n"
|
|
||||||
"=| method: " (pr-str (:request-method request)) "\n"
|
"=| method: " (pr-str (:request-method request)) "\n"
|
||||||
"=| params: " (pr-str (:params request)) "\n"
|
"=| params: " (pr-str (:params request)) "\n"
|
||||||
(when (ex/ex-info? err)
|
|
||||||
(str "=| ex-data: " (pr-str (ex-data err)) "\n"))
|
(when (map? edata)
|
||||||
|
(str "=| ex-data: " (pr-str edata) "\n"))
|
||||||
|
|
||||||
"\n"))
|
"\n"))
|
||||||
|
|
||||||
(defmulti handle-exception
|
(defmulti handle-exception
|
||||||
|
@ -84,9 +85,12 @@
|
||||||
(log/errorf error
|
(log/errorf error
|
||||||
(str "Internal Error\n"
|
(str "Internal Error\n"
|
||||||
(get-context-string request edata)))
|
(get-context-string request edata)))
|
||||||
|
(if (nil? edata)
|
||||||
{:status 500
|
{:status 500
|
||||||
:body (dissoc edata :data)}))
|
:body {:type :server-error
|
||||||
|
:hint (ex-message error)}}
|
||||||
|
{:status 500
|
||||||
|
:body (dissoc edata :data)})))
|
||||||
|
|
||||||
(defn handle
|
(defn handle
|
||||||
[error req]
|
[error req]
|
||||||
|
|
|
@ -38,9 +38,11 @@
|
||||||
(rx/throw {:type :offline})
|
(rx/throw {:type :offline})
|
||||||
|
|
||||||
:else
|
:else
|
||||||
(rx/throw {:type :server-error
|
(rx/throw (merge {:type :server-error
|
||||||
:status (:status response)
|
:status (:status response)}
|
||||||
:body (:body response)})))
|
(:body response)))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(defn send-query!
|
(defn send-query!
|
||||||
[id params]
|
[id params]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue