This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-15
Channels
- # adventofcode (1)
- # beginners (79)
- # boot (23)
- # cider (15)
- # cljs-dev (14)
- # cljsrn (27)
- # clojars (4)
- # clojure (172)
- # clojure-dusseldorf (23)
- # clojure-india (2)
- # clojure-italy (1)
- # clojure-nl (23)
- # clojure-russia (43)
- # clojure-spec (29)
- # clojure-uk (70)
- # clojurescript (97)
- # clr (8)
- # cursive (10)
- # datomic (69)
- # events (3)
- # garden (12)
- # hoplon (120)
- # immutant (34)
- # lein-figwheel (9)
- # leiningen (4)
- # off-topic (4)
- # om (10)
- # onyx (51)
- # rdf (1)
- # re-frame (15)
- # reagent (23)
- # ring-swagger (8)
- # test-check (3)
- # untangled (96)
- # yada (1)
I wonder if there is a way to make sense of such a spec message: http://pastebin.com/QrU49Thr
its hard to figure out if I am just missing a key somewhere or if the structure in general (coll-of (coll-of ...)) is broken
I think there might be more than one thing wrong too
this: val: 16 fails spec: :de.sveri.getless.service.off/id at: [:args :foods :id] predicate: string?
seems pretty straightforward
the :id key is an int not a string
the foods arg also seems to be missing some keys
:de.sveri.getless.service.off/product at: [:args :foods] predicate: (contains? % :image_small_url)
:de.sveri.getless.service.off/product at: [:args :foods] predicate: (contains? % :image_thumb_url)
:de.sveri.getless.service.off/product at: [:args :foods] predicate: (contains? % :lang)
:de.sveri.getless.service.off/product at: [:args :foods] predicate: (contains? % :code)
:de.sveri.getless.service.off/product at: [:args :foods] predicate: (contains? % :rev)
@alexmiller Yea, thats right, uhm, ok, I am, surprised
looking at the line breaks
It took me a lot of time figuring out the first error, then reload and look for the second one. My problem is, its just a wall of text.
each line is a problem - those are the ends of the lines
the (large) data value is the distracting part in each line
you can install a custom explain printer too if you want (could actually hide the val, or limit it’s size)
That sounds good, my application makes use of an external service, that returns a lot of data. Is there an example somewhere on how to make a custom printer?
(set! s/*explain-out*
(fn [explain-data]
(binding [*print-length* 3]
(s/explain-printer explain-data))))
*explain-out*
is a dynamic variable holding the function that prints explain data
^^ that will work at the repl, but you might need to use with-bindings
to make it work in your code
s/explain-printer
is the default print function
this example limits *print-length*
to 3 when printing big collections
(that’s the most common source of large printed values)
for example (s/explain empty? (range 100))
with the above will not print the full seq
Awesome 🙂
First question, may I put that on a gist with your comments and
second: when I try your code it throws the following exception during runtime: java.lang.IllegalStateException: Can't change/establish root binding of: *explain-out* with set
Yes and that's what I mentioned
It works at the repl because the repl binds explain-out
But in your code you need to set it in a dynamic scope with something like binding
Or alter-var-root it
I should probably just write a quick blog on it
@alexmiller Great, I got it now 🙂 thank you very much