mirror of
https://github.com/penpot/penpot.git
synced 2026-08-23 05:08:53 +00:00
Merge pull request #6844 from penpot/niwinz-staging-enhancements
✨ Improve error reporting
This commit is contained in:
commit
a41af032cd
@ -41,7 +41,7 @@
|
|||||||
(if (or (instance? java.util.concurrent.CompletionException cause)
|
(if (or (instance? java.util.concurrent.CompletionException cause)
|
||||||
(instance? java.util.concurrent.ExecutionException cause))
|
(instance? java.util.concurrent.ExecutionException cause))
|
||||||
(-> record
|
(-> record
|
||||||
(assoc ::trace (ex/format-throwable cause :data? false :explain? false :header? false :summary? false))
|
(assoc ::trace (ex/format-throwable cause :data? true :explain? false :header? false :summary? false))
|
||||||
(assoc ::l/cause (ex-cause cause))
|
(assoc ::l/cause (ex-cause cause))
|
||||||
(record->report))
|
(record->report))
|
||||||
|
|
||||||
@ -64,18 +64,18 @@
|
|||||||
message))
|
message))
|
||||||
@message)
|
@message)
|
||||||
:trace (or (::trace record)
|
:trace (or (::trace record)
|
||||||
(some-> cause (ex/format-throwable :data? false :explain? false :header? false :summary? false)))}
|
(some-> cause (ex/format-throwable :data? true :explain? false :header? false :summary? false)))}
|
||||||
|
|
||||||
(when-let [params (or (:request/params context) (:params context))]
|
(when-let [params (or (:request/params context) (:params context))]
|
||||||
{:params (pp/pprint-str params :length 30 :level 13)})
|
{:params (pp/pprint-str params :length 20 :level 15)})
|
||||||
|
|
||||||
(when-let [value (:value context)]
|
(when-let [value (:value context)]
|
||||||
{:value (pp/pprint-str value :length 30 :level 12)})
|
{:value (pp/pprint-str value :length 30 :level 13)})
|
||||||
|
|
||||||
(when-let [data (some-> data (dissoc ::s/problems ::s/value ::s/spec ::sm/explain :hint))]
|
(when-let [data (some-> data (dissoc ::s/problems ::s/value ::s/spec ::sm/explain :hint))]
|
||||||
{:data (pp/pprint-str data :length 30 :level 12)})
|
{:data (pp/pprint-str data :length 30 :level 13)})
|
||||||
|
|
||||||
(when-let [explain (ex/explain data :length 30 :level 12)]
|
(when-let [explain (ex/explain data :length 30 :level 13)]
|
||||||
{:explain explain})))))
|
{:explain explain})))))
|
||||||
|
|
||||||
(defn error-record?
|
(defn error-record?
|
||||||
|
|||||||
@ -559,6 +559,8 @@
|
|||||||
f.project_id,
|
f.project_id,
|
||||||
f.created_at,
|
f.created_at,
|
||||||
f.modified_at,
|
f.modified_at,
|
||||||
|
f.data_backend,
|
||||||
|
f.data_ref_id,
|
||||||
f.name,
|
f.name,
|
||||||
f.version,
|
f.version,
|
||||||
f.is_shared,
|
f.is_shared,
|
||||||
|
|||||||
@ -47,10 +47,26 @@
|
|||||||
`(try ~@exprs (catch Throwable e# nil))))
|
`(try ~@exprs (catch Throwable e# nil))))
|
||||||
|
|
||||||
(defmacro try!
|
(defmacro try!
|
||||||
[& exprs]
|
[expr & {:keys [reraise-with on-exception]}]
|
||||||
(if (:ns &env)
|
(let [ex-sym
|
||||||
`(try ~@exprs (catch :default e# e#))
|
(gensym "exc")
|
||||||
`(try ~@exprs (catch Throwable e# e#))))
|
|
||||||
|
generate-catch
|
||||||
|
(fn []
|
||||||
|
(cond
|
||||||
|
(map? reraise-with)
|
||||||
|
`(ex/raise ~@(mapcat identity reraise-with) :cause ~ex-sym)
|
||||||
|
|
||||||
|
on-exception
|
||||||
|
`(let [handler# ~on-exception]
|
||||||
|
(handler# ~ex-sym))
|
||||||
|
|
||||||
|
:else
|
||||||
|
ex-sym))]
|
||||||
|
|
||||||
|
(if (:ns &env)
|
||||||
|
`(try ~expr (catch :default ~ex-sym ~(generate-catch)))
|
||||||
|
`(try ~expr (catch Throwable ~ex-sym ~(generate-catch))))))
|
||||||
|
|
||||||
(defn ex-info?
|
(defn ex-info?
|
||||||
[v]
|
[v]
|
||||||
|
|||||||
@ -487,7 +487,9 @@
|
|||||||
(cts/shape? shape-new))
|
(cts/shape? shape-new))
|
||||||
(ex/raise :type :assertion
|
(ex/raise :type :assertion
|
||||||
:code :data-validation
|
:code :data-validation
|
||||||
:hint "invalid shape found after applying changes"
|
:hint (str "invalid shape found after applying changes on file "
|
||||||
|
(:id data-new))
|
||||||
|
:file-id (:id data-new)
|
||||||
::sm/explain (cts/explain-shape shape-new))))))]
|
::sm/explain (cts/explain-shape shape-new))))))]
|
||||||
|
|
||||||
(->> (into #{} (map :page-id) items)
|
(->> (into #{} (map :page-id) items)
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
(:require
|
(:require
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[app.common.data.macros :as dm]
|
[app.common.data.macros :as dm]
|
||||||
|
[app.common.exceptions :as ex]
|
||||||
[app.common.files.helpers :as cpf]
|
[app.common.files.helpers :as cpf]
|
||||||
[app.common.geom.matrix :as gmt]
|
[app.common.geom.matrix :as gmt]
|
||||||
[app.common.geom.point :as gpt]
|
[app.common.geom.point :as gpt]
|
||||||
@ -205,8 +206,18 @@
|
|||||||
"Calculate the boolean content from shape and objects. Returns a
|
"Calculate the boolean content from shape and objects. Returns a
|
||||||
packed PathData instance"
|
packed PathData instance"
|
||||||
[shape objects]
|
[shape objects]
|
||||||
(-> (calc-bool-content* shape objects)
|
(ex/try!
|
||||||
(impl/path-data)))
|
(-> (calc-bool-content* shape objects)
|
||||||
|
(impl/path-data))
|
||||||
|
|
||||||
|
:on-exception
|
||||||
|
(fn [cause]
|
||||||
|
(ex/raise :type :internal
|
||||||
|
:code :invalid-path-content
|
||||||
|
:hint (str "unable to create bool content for shape " (:id shape))
|
||||||
|
:content (str (:content shape))
|
||||||
|
:shape-id (:id shape)
|
||||||
|
:cause cause))))
|
||||||
|
|
||||||
(defn update-bool-shape
|
(defn update-bool-shape
|
||||||
"Calculates the selrect+points for the boolean shape"
|
"Calculates the selrect+points for the boolean shape"
|
||||||
|
|||||||
@ -412,7 +412,7 @@
|
|||||||
|
|
||||||
(defn calculate-content
|
(defn calculate-content
|
||||||
"Create a bool content from a collection of contents and specified
|
"Create a bool content from a collection of contents and specified
|
||||||
type."
|
type. Returns plain segments"
|
||||||
[bool-type contents]
|
[bool-type contents]
|
||||||
;; We apply the boolean operation in to each pair and the result to the next
|
;; We apply the boolean operation in to each pair and the result to the next
|
||||||
;; element
|
;; element
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user