Fork me on GitHub
#clojure-spec
<
2022-11-11
>
jmmk13:11:17

Is there a better way to accomplish this? I find in each place I am using conform, I want it to fail (throw) if it is invalid

(defn conform! [spec v]
  (let [conformed-value (s/conform spec v)]
    (if (s/invalid? conformed-value)
      (throw
        (ex-info
          "value did not conform to spec"
          (s/explain-data spec v)))
      conformed-value)))