Fork me on GitHub
#dirac
<
2017-01-05
>
martinklepsch17:01:46

Hey 🙂

martinklepsch17:01:58

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

martinklepsch17:01:34

It’s almost certainly caused by my wonky custom type though 😄

darwin17:01:08

@martinklepsch I would need to see full stack trace

darwin17:01:55

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

darwin17:01:38

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

martinklepsch17:01:24

(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

darwin17:01:19

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

darwin17:01:28

do you get the same error?

darwin17:01:49

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

darwin17:01:26

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

martinklepsch17:01:43

this is my IPrintWriter impl:

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

martinklepsch17:01:06

yeah, no devtools in stacktrace

martinklepsch17:01:03

I’ll investigate. Sorry for the confusion 🙂

darwin17:01:04

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

darwin17:01:57

use that print snippet and stop devtools on exceptions

darwin17:01:02

investigate the callstack