0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 23:49:45 -05:00

Add more improvements to error reporting

This commit is contained in:
Andrey Antukh 2023-08-04 10:45:17 +02:00
parent 2ba7996116
commit 259b05db51
2 changed files with 8 additions and 17 deletions

View file

@ -47,7 +47,7 @@
(assoc :public-uri (cf/get :public-uri))
(assoc :logger/name logger)
(assoc :logger/level level)
(dissoc :request/params))]
(dissoc :request/params :value :params :data))]
(merge
{:context (-> (into (sorted-map) context)
(pp/pprint-str :width 200 :length 50 :level 10))
@ -55,7 +55,7 @@
:hint (or (ex-message cause) @message)
:trace (ex/format-throwable cause :data? false :explain? false :header? false :summary? false)}
(when-let [params (:request/params context)]
(when-let [params (or (:request/params context) (:params context))]
{:params (pp/pprint-str params :width 200)})
(when-let [value (:value context)]
@ -67,7 +67,6 @@
(when-let [explain (ex/explain data {:level 10 :length 50})]
{:explain explain}))))
(defn error-record?
[{:keys [::l/level ::l/cause]}]
(and (= :error level)

View file

@ -489,16 +489,8 @@
(l/error :hint "worker: unhandled exception" :cause cause))))))
(defn- get-error-context
[error item]
(let [data (ex-data error)]
(merge
{:hint (ex-message error)
:spec-problems (some->> data ::s/problems (take 10) seq vec)
:spec-value (some->> data ::s/value)
:data (some-> data (dissoc ::s/problems ::s/value ::s/spec))
:params item}
(when-let [explain (ex/explain data)]
{:spec-explain explain}))))
[_ item]
{:params item})
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; CRON
@ -597,10 +589,10 @@
(catch InterruptedException _
(l/debug :hint "cron: task interrupted" :task-id id))
(catch Throwable cause
(l/error :hint "cron: unhandled exception on running task"
::l/context (get-error-context cause task)
:task-id id
:cause cause))
(binding [l/*context* (get-error-context cause task)]
(l/error :hint "cron: unhandled exception on running task"
:task-id id
:cause cause)))
(finally
(when-not (px/interrupted? :current)
(schedule-cron-task cfg task))))))