cljs.spec/explain-printer
function | removed v1.9.542 | added v1.9.293 | Edit |
(explain-printer ed)
Source docstring:
Default printer for explain-data. nil indicates a successful validation.
(defn explain-printer
[ed]
(if ed
(print
(with-out-str
(doseq [{:keys [path pred val reason via in] :as prob} (::problems ed)]
(when-not (empty? in)
(print "In:" (pr-str in) ""))
(print "val: ")
(pr val)
(print " fails")
(when-not (empty? via)
(print " spec:" (pr-str (last via))))
(when-not (empty? path)
(print " at:" (pr-str path)))
(print " predicate: ")
(pr (abbrev pred))
(when reason (print ", " reason))
(doseq [[k v] prob]
(when-not (#{:path :pred :val :reason :via :in} k)
(print "\n\t" (pr-str k) " ")
(pr v)))
(newline))
(doseq [[k v] ed]
(when-not (#{::problems} k)
(print (pr-str k) " ")
(pr v)
(newline)))))
(println "Success!")))