Logging the message where the error originates
helps a lot in finding the bug.
This commit is contained in:
parent
74458fc78c
commit
a2afd38e9a
|
@ -10,10 +10,10 @@
|
||||||
;;
|
;;
|
||||||
(defn check-and-throw
|
(defn check-and-throw
|
||||||
"Throw an exception if db doesn't have a valid spec."
|
"Throw an exception if db doesn't have a valid spec."
|
||||||
[spec db]
|
[spec db [msg]]
|
||||||
(when-not (s/valid? spec db)
|
(when-not (s/valid? spec db)
|
||||||
(let [explain-data (s/explain-data 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
|
(def validate-spec
|
||||||
(if goog.DEBUG
|
(if goog.DEBUG
|
||||||
|
|
Loading…
Reference in New Issue