mirror of
https://github.com/penpot/penpot.git
synced 2025-08-01 06:58:34 +02:00
✨ Improve error reporting of tasks.
This commit is contained in:
parent
816db29f9c
commit
80309cbff3
5 changed files with 50 additions and 27 deletions
|
@ -12,6 +12,7 @@
|
|||
(:require
|
||||
[app.common.uuid :as uuid]
|
||||
[app.config :as cfg]
|
||||
[app.util.log4j :refer [update-thread-context!]]
|
||||
[clojure.pprint :refer [pprint]]
|
||||
[clojure.tools.logging :as log]
|
||||
[cuerdas.core :as str]
|
||||
|
@ -19,19 +20,6 @@
|
|||
(:import
|
||||
org.apache.logging.log4j.ThreadContext))
|
||||
|
||||
(defn update-thread-context!
|
||||
[data]
|
||||
(run! (fn [[key val]]
|
||||
(ThreadContext/put
|
||||
(name key)
|
||||
(cond
|
||||
(coll? val)
|
||||
(binding [clojure.pprint/*print-right-margin* 120]
|
||||
(with-out-str (pprint val)))
|
||||
(instance? clojure.lang.Named val) (name val)
|
||||
:else (str val))))
|
||||
data))
|
||||
|
||||
(defn- explain-error
|
||||
[error]
|
||||
(with-out-str
|
||||
|
@ -48,10 +36,8 @@
|
|||
:version (:full cfg/version)
|
||||
:host (:public-uri cfg/config)
|
||||
:class (.getCanonicalName ^java.lang.Class (class error))
|
||||
:hint (ex-message error)}
|
||||
|
||||
(when (map? edata)
|
||||
edata)
|
||||
:hint (ex-message error)
|
||||
:data edata}
|
||||
|
||||
(when (and (map? edata) (:data edata))
|
||||
{:explain (explain-error edata)}))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue