dirac 2017-01-05

Hey πŸ™‚

CLJS DevTools Error me.cljs$core$IMapEntry$_val$arity$1 is not a function
I’m getting an exception like this one from the reporting stuff

It’s almost certainly caused by my wonky custom type though πŸ˜„

@martinklepsch I would need to see full stack trace

cljs-devtools uses clojurescript printing machinery, so it can easily raise exceptions, for example when printing something with buggy IPrintWithWriter methods

but it should not break you much, because the exception guard should catch exceptions raised during printing: https://github.com/binaryage/cljs-devtools/blob/master/src/lib/devtools/formatters/core.cljs#L66

(js/console.log 'vals (type (vals {:a 1 :b 2})))
(js/console.log 'check-in-vals (type (vals (org.martinklepsch.cc-set/set-by :id {:id 1} {:id 2}))))

(js/console.log 'vals (vals {:a 1 :b 2}))
(js/console.log 'check-in-vals (vals (org.martinklepsch.cc-set/set-by :id {:id 1} {:id 2})))       
So both of these return ValSeqs but the last log statement causes the above exception

what happens if you do (print (vals (org.martinklepsch.cc-set/set-by :id {:id 1} {:id 2}))) ?

do you get the same error?

this looks to me as a bug in cljs.core.ValSeq.cljs$core$IPrintWithWriter

same issue

print should not have anything to do with cljs-devtools, can you confirm from the stack trace?

this is my IPrintWriter impl:

IPrintWithWriter
  (-pr-writer [coll writer _]
    (let [items (string/join " " (map pr-str (seq coll)))]
      (-write writer (str "#CustomComparatorSet{" items β€œ}"))))

yeah, no devtools in stacktrace

I’ll investigate. Sorry for the confusion πŸ™‚

cannot reason about that code, coll seems to have something inside which cannot be processed by pr-str

use that print snippet and stop devtools on exceptions

investigate the callstack