🐛 Fix incorrect erorr reporting.

This commit is contained in:
Andrey Antukh 2020-12-10 21:51:48 +01:00 committed by Alonso Torres
parent 8f37f74d29
commit 01edf49de0
4 changed files with 24 additions and 8 deletions

View file

@ -186,10 +186,16 @@
[spec data]
(let [result (s/conform spec data)]
(when (= result ::s/invalid)
(let [edata (s/explain-data spec data)]
(let [edata (s/explain-data spec data)
nhint (with-out-str
(s/explain-out edata))
vhint (with-out-str
(expound/printer edata))]
(throw (ex/error :type :validation
:code :spec-validation
:data data))))
:data data
:hint nhint
:hint-verbose vhint))))
result))
(defmacro instrument!