mirror of https://github.com/penpot/penpot.git
🐛 Fix corrner case on error report validationt
This commit is contained in:
parent
1b6a833166
commit
39bdf026ca
|
|
@ -80,7 +80,7 @@
|
|||
[:file-id ::sm/uuid]
|
||||
[:page-id {:optional true} [:maybe ::sm/uuid]]])
|
||||
|
||||
(def check-error!
|
||||
(def check-error
|
||||
(sm/check-fn schema:error))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
@ -96,21 +96,17 @@
|
|||
|
||||
(defn- report-error
|
||||
[code hint shape file page & {:as args}]
|
||||
(let [error {:code code
|
||||
:hint hint
|
||||
:shape shape
|
||||
:file-id (:id file)
|
||||
:page-id (:id page)
|
||||
:shape-id (:id shape)
|
||||
:args args}]
|
||||
(let [error (d/without-nils
|
||||
{:code code
|
||||
:hint hint
|
||||
:shape shape
|
||||
:file-id (:id file)
|
||||
:page-id (:id page)
|
||||
:shape-id (:id shape)
|
||||
:args args})]
|
||||
|
||||
(dm/assert!
|
||||
"expected a valid `*errors*` dynamic binding"
|
||||
(some? *errors*))
|
||||
|
||||
(dm/assert!
|
||||
"expected valid error"
|
||||
(check-error! error))
|
||||
(assert (some? *errors*) "expected a valid `*errors*` dynamic binding")
|
||||
(assert (check-error error))
|
||||
|
||||
(vswap! *errors* conj error)))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue