diff --git a/common/src/app/common/pages/changes.cljc b/common/src/app/common/pages/changes.cljc index 280a1049f8..24be8c578a 100644 --- a/common/src/app/common/pages/changes.cljc +++ b/common/src/app/common/pages/changes.cljc @@ -71,8 +71,8 @@ [:obj :map] [:page-id {:optional true} ::sm/uuid] [:component-id {:optional true} ::sm/uuid] - [:frame-id {:optional true} ::sm/uuid] - [:parent-id {:optional true} ::sm/uuid] + [:frame-id ::sm/uuid] + [:parent-id {:optional true} [:maybe ::sm/uuid]] [:index {:optional true} [:maybe :int]] [:ignore-touched {:optional true} :boolean]]] diff --git a/frontend/src/app/main/data/workspace/svg_upload.cljs b/frontend/src/app/main/data/workspace/svg_upload.cljs index 4181fcbf5b..52c2a60293 100644 --- a/frontend/src/app/main/data/workspace/svg_upload.cljs +++ b/frontend/src/app/main/data/workspace/svg_upload.cljs @@ -9,7 +9,6 @@ [app.common.colors :as clr] [app.common.data :as d] [app.common.data.macros :as dm] - [app.common.exceptions :as ex] [app.common.files.helpers :as cfh] [app.common.geom.matrix :as gmt] [app.common.geom.point :as gpt] @@ -38,14 +37,12 @@ {:x 0 :y 0 :width 1 :height 1}) (defn- assert-valid-num [attr num] - (when-not (and (d/num? num) - (<= num max-safe-int) - (>= num min-safe-int)) - (ex/raise :type :assertion - :code :expr-validation - :hint (str/ffmt "%1 attribute has invalid value: %2" (d/name attr) num))) + (dm/verify! + ["%1 attribute has invalid value: %2" (d/name attr) num] + (and (d/num? num) + (<= num max-safe-int) + (>= num min-safe-int))) - ;; If the number is between 0-1 we round to 1 (same in negative form (cond (and (> num 0) (< num 1)) 1 (and (< num 0) (> num -1)) -1 @@ -53,22 +50,19 @@ (defn- assert-valid-pos-num [attr num] - (when-not (pos? num) - (ex/raise :type :assertion - :code :expr-validation - :hint (str/ffmt "%1 attribute should be positive" (d/name attr)))) + + (dm/verify! + ["%1 attribute should be positive" (d/name attr)] + (pos? num)) + num) (defn- assert-valid-blend-mode [mode] - (let [clean-value (-> mode - str/trim - str/lower - keyword)] - (when-not (contains? cts/blend-modes clean-value) - (ex/raise :type :assertion - :code :expr-validation - :hint (str/ffmt "%1 is not a valid blend mode" clean-value))) + (let [clean-value (-> mode str/trim str/lower keyword)] + (dm/verify! + ["%1 is not a valid blend mode" clean-value] + (contains? cts/blend-modes clean-value)) clean-value)) (defn- svg-dimensions [data]