Hi
Not sure if it's your intend for this to cover both CLJ and CLJS but one early pain point for CLJS is the printing of large datastructures as part of explain-out.
Using Google Chrome and cljs-devtools gives us custom formatters on the console which means we can drill down into maps/vectors, see pretty printed keywords etc. Big step forward!
This is a totally hacky port which vaguely does as described:
(defn explain-console
"print an explanation to js/console.log"
[ed]
(let [print (fn [& args] (.apply (.-log js/console) js/console (to-array args)))]
(if ed
(do
(doseq [[path {:keys [pred val reason via in] :as prob}] (::s/problems ed)]
(when-not (empty? in)
(print "In:" in ""))
(print " val: " val)
(when-not (empty? via)
(print " fails spec:" (last via)))
(when-not (empty? path)
(print " at:" path))
(print " predicate: " pred)
(when reason (print ", " reason))
(doseq [[k v] prob]
(when-not (#{:pred :val :reason :via :in} k)
(print k " " v))))
(doseq [[k v] ed]
(when-not (#{::s/problems} k)
(print k " " v))))
(println "Success!"))))
Hi
Not sure if it's your intend for this to cover both CLJ and CLJS but one early pain point for CLJS is the printing of large datastructures as part of explain-out.
Using Google Chrome and cljs-devtools gives us custom formatters on the console which means we can drill down into maps/vectors, see pretty printed keywords etc. Big step forward!
This is a totally hacky port which vaguely does as described: