🐛 Fix corrner case on error report validationt

This commit is contained in:
Andrey Antukh 2025-10-14 12:22:46 +02:00
parent 1b6a833166
commit 39bdf026ca

View File

@ -80,7 +80,7 @@
[:file-id ::sm/uuid] [:file-id ::sm/uuid]
[:page-id {:optional true} [:maybe ::sm/uuid]]]) [:page-id {:optional true} [:maybe ::sm/uuid]]])
(def check-error! (def check-error
(sm/check-fn schema:error)) (sm/check-fn schema:error))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -96,21 +96,17 @@
(defn- report-error (defn- report-error
[code hint shape file page & {:as args}] [code hint shape file page & {:as args}]
(let [error {:code code (let [error (d/without-nils
:hint hint {:code code
:shape shape :hint hint
:file-id (:id file) :shape shape
:page-id (:id page) :file-id (:id file)
:shape-id (:id shape) :page-id (:id page)
:args args}] :shape-id (:id shape)
:args args})]
(dm/assert! (assert (some? *errors*) "expected a valid `*errors*` dynamic binding")
"expected a valid `*errors*` dynamic binding" (assert (check-error error))
(some? *errors*))
(dm/assert!
"expected valid error"
(check-error! error))
(vswap! *errors* conj error))) (vswap! *errors* conj error)))