0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-02 04:19:08 -05:00

Add minor improvement on error reporting on shape validation

This commit is contained in:
Andrey Antukh 2024-10-28 14:16:34 +01:00
parent e533762f33
commit 7c73e44ab8
3 changed files with 6 additions and 2 deletions

View file

@ -63,7 +63,7 @@
(ex/format-throwable cause :data? false :explain? false :header? false :summary? false))} (ex/format-throwable cause :data? false :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 12)}) {:params (pp/pprint-str params :length 30 :level 13)})
(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 12)})

View file

@ -418,7 +418,8 @@
(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 "invalid shape found after applying changes"
::sm/explain (cts/explain-shape shape-new))))))]
(->> (into #{} (map :page-id) items) (->> (into #{} (map :page-id) items)
(mapcat (fn [page-id] (mapcat (fn [page-id]

View file

@ -361,6 +361,9 @@
(def valid-shape? (def valid-shape?
(sm/lazy-validator schema:shape)) (sm/lazy-validator schema:shape))
(def explain-shape
(sm/lazy-explainer schema:shape))
(defn has-images? (defn has-images?
[{:keys [fills strokes]}] [{:keys [fills strokes]}]
(or (some :fill-image fills) (or (some :fill-image fills)