From 39bdf026ca686e3d8d32260b485642904fb683aa Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 14 Oct 2025 12:22:46 +0200 Subject: [PATCH] :bug: Fix corrner case on error report validationt --- common/src/app/common/files/validate.cljc | 26 ++++++++++------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/common/src/app/common/files/validate.cljc b/common/src/app/common/files/validate.cljc index 02887b5f5e..542652bf04 100644 --- a/common/src/app/common/files/validate.cljc +++ b/common/src/app/common/files/validate.cljc @@ -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)))