mirror of
https://github.com/penpot/penpot.git
synced 2025-05-30 22:06:12 +02:00
✨ Add better error reporting on changes validation
This commit is contained in:
parent
a2f466810b
commit
b82c6326cf
5 changed files with 24 additions and 14 deletions
|
@ -109,9 +109,12 @@
|
|||
file-id file-revn undo-group tags stack-undo? source]}]
|
||||
|
||||
(dm/assert!
|
||||
"expect valid vector of changes"
|
||||
(and (cpc/valid-changes? redo-changes)
|
||||
(cpc/valid-changes? undo-changes)))
|
||||
"expect valid vector of changes for redo-changes"
|
||||
(cpc/check-changes! redo-changes))
|
||||
|
||||
(dm/assert!
|
||||
"expect valid vector of changes for undo-changes"
|
||||
(cpc/check-changes! undo-changes))
|
||||
|
||||
(let [commit-id (or commit-id (uuid/next))
|
||||
source (d/nilv source :local)
|
||||
|
|
|
@ -675,8 +675,15 @@
|
|||
|
||||
(defn ext-library-changed
|
||||
[library-id modified-at revn changes]
|
||||
(dm/assert! (uuid? library-id))
|
||||
(dm/assert! (ch/valid-changes? changes))
|
||||
|
||||
(dm/assert!
|
||||
"expected valid uuid for library-id"
|
||||
(uuid? library-id))
|
||||
|
||||
(dm/assert!
|
||||
"expected valid changes vector"
|
||||
(ch/check-changes! changes))
|
||||
|
||||
(ptk/reify ::ext-library-changed
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
(:require
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.pprint :as pp]
|
||||
[app.common.schema :as-alias sm]
|
||||
[app.common.schema :as sm]
|
||||
[app.main.data.modal :as modal]
|
||||
[app.main.data.notifications :as ntf]
|
||||
[app.main.data.users :as du]
|
||||
|
@ -32,8 +32,11 @@
|
|||
|
||||
(defn- print-explain!
|
||||
[data]
|
||||
(when-let [explain (or (ex/explain data)
|
||||
(:explain data))]
|
||||
(when-let [{:keys [errors] :as explain} (::sm/explain data)]
|
||||
(let [errors (mapv #(update % :schema sm/form) errors)]
|
||||
(pp/pprint errors {:width 100 :level 15 :length 20})))
|
||||
|
||||
(when-let [explain (:explain data)]
|
||||
(js/console.log explain)))
|
||||
|
||||
(defn- print-trace!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue