Fork me on GitHub
#nbb
<
2022-12-19
>
Ben Lieberman18:12:07

Is there a way to get line numbers in error messages? All I'm seeing is this:

----- Error --------------------------------------
Type:     SyntaxError
Message:  Unexpected token u in JSON at position 0
Unexpected token u in JSON at position 0

borkdude18:12:34

It depends, need a fuller repro

Ben Lieberman18:12:25

I'm working in this p/let block

(p/let [content (fs/readFile credentials-path (fn [r] r))
          keys (try (js/JSON.parse content) (catch js/Error _ (js/console.log "this is where it breaks"))))
and have narrowed down the error to the JSON.parse. So not necessary to get line no's in this particular case. I think metadata for functions supports line #s though, right? in JVM Clojure at least.

borkdude18:12:07

Normally you get a line number but in async code this often gets lost in nbb. Could make an issue to see if something can be done about it

Ben Lieberman19:12:29

Yeah, I'll tinker with this. CLJS is not a strong suit of mine so I'd like to figure this out for this little script and then I can put the issue in if you like.

👍 1