Fork me on GitHub
#clojurescript
<
2023-07-05
>
Lidor Cohen09:07:51

hello! I'm getting a repl exception:

:repl/exception!
; 
; Execution error (Error) at (<cljs repl>:1).
; No protocol method IDeref.-deref defined for type cljs.core/PersistentArrayMap: {:style "color: red;"}
and I was wondering, what tools do I have to investigate this exception? stack trace? etc...

vanelsas09:07:39

You may want to show more code if you require help, but in general this style element doesn't look properly formatted. You can try this instead {:style {:color "red"}}

delaguardo09:07:35

how do you start your repl?

Lidor Cohen09:07:28

hmm calva jack-in -> shadow-cljs

delaguardo09:07:45

targeting browser?

delaguardo09:07:51

probably there is an error in the console. where you can find stacktrace

Lidor Cohen10:07:32

isn't there a way to investigate the exception from within the environment with the repl?

Lidor Cohen10:07:55

@U01M742UT8F thank you for your help 🙂 I'm more interested in tools to investigate exceptions and not in this particular exception

vanelsas10:07:19

apologies, misread the question in a hurry 😉

delaguardo10:07:08

hm... looks like exception reporting is getting worst from how I remember it. Sorry, didn't use cljs for a while.

rolt11:07:47

(cljs.repl/pst) for some reason doesn't work for me 😕 (println (.-stack *e)) ? there should be something better

Lidor Cohen13:07:37

I also tried *e but it's nil for some reason 😕

rolt13:07:49

that's weird, works for me with a shadow-cljs repl

rolt13:07:33

I'm using cider instead of calva but I don't think that changes anything

Lidor Cohen13:07:01

let me try another exception

Ryan19:07:02

Does anyone know why (number? ##NaN) evaluates to true? What CAN I use to determine if a value is, in fact, a number?

p-himik19:07:06

NaN is typed as a number. To check for only proper numbers, you can combine number? with NaN? and perhaps infinite?.

👍 1
Ryan19:07:04

Thanks, @U2FRKM4TW !

👍 1
Ryan19:07:27

NaN being a number might be the most javascript thing ever 😉

p-himik19:07:19

It's actually an IEEE 754 thing - this is the case in many (probably most) languages. You'll see the same thing in Java and, consequently, Clojure.

jshell> Double x = Double.NaN
x ==> NaN

jshell> x instanceof Number
$3 ==> true

👌 1