Logging the message where the error originates

helps a lot in finding the bug.
This commit is contained in:
Fabian Aussems 2016-10-24 12:53:42 +02:00 committed by GitHub
parent 74458fc78c
commit a2afd38e9a
1 changed files with 2 additions and 2 deletions

View File

@ -10,10 +10,10 @@
;;
(defn check-and-throw
"Throw an exception if db doesn't have a valid spec."
[spec db]
[spec db [msg]]
(when-not (s/valid? spec db)
(let [explain-data (s/explain-data spec db)]
(throw (ex-info (str "Spec check failed: " explain-data) explain-data)))))
(throw (ex-info (str "Spec check " msg " failed: " explain-data) explain-data)))))
(def validate-spec
(if goog.DEBUG