mirror of
https://github.com/penpot/penpot.git
synced 2026-04-29 05:08:08 +00:00
🐛 Ensure verify! works as expected on production builds
This commit is contained in:
parent
02fbce13f0
commit
390f2b35fc
@ -153,6 +153,22 @@
|
||||
(throw (ex-info hint# params#)))))))))
|
||||
|
||||
(defmacro verify!
|
||||
[& params]
|
||||
(binding [*assert* true]
|
||||
`(assert! ~@params)))
|
||||
([expr]
|
||||
`(assert! nil ~expr))
|
||||
([hint expr]
|
||||
(let [hint (cond
|
||||
(vector? hint)
|
||||
`(str/ffmt ~@hint)
|
||||
|
||||
(some? hint)
|
||||
hint
|
||||
|
||||
:else
|
||||
(str "expr assert: " (pr-str expr)))]
|
||||
`(binding [*assert-context* true]
|
||||
(when-not ~expr
|
||||
(let [hint# ~hint
|
||||
params# {:type :assertion
|
||||
:code :expr-validation
|
||||
:hint hint#}]
|
||||
(throw (ex-info hint# params#))))))))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user