Hello! I can't get ClojureScript to work with emacs's Cider, can someone help me? I asked this on stackoverflow, they directed me here https://stackoverflow.com/questions/79776730/no-cider-error-buffer-and-no-stacktraces-with-shadow-cljs
Hi Eva, welcome! If you don't get a timely answer here in #beginners feel free to forward your post to #cider (I don't do ClojureScript and don't use Emacs, so I can't be much help, I'm afraid).
(and there's also #shadow-cljs as Harold noted on SO)
the stacktraces should appear in whatever the shadow-cljs stdout is
which is probably the REPL buffer itself
if you evaluate something that throws an exception, you should still see the little :repl/exception inline result
Yeah exactly - you'll see them in your browser console log. Also see some info in the CLJS repl if you have it open
The repl buffer tells me the exception, but not the stacktrace. If says something like "invalid arity: 1", but it doesn't show which function threw it and where the error occurred
Same for the console log
I see the exception, but I also want to see the stacktrace, like it works when I work with clj
The compilation/evaluation model is different, so I wouldn't expect to have the same workflow. CIDER captures Clojure stacktraces bc the source is being compiled and executed in one go; in ClojureScript, the compiler (a Clojure program) can error, in which case you might (I am frankly not certain) see a compiler stacktrace in your CIDER error buffer. But if you write code that causes a runtime exception, CIDER doesn't recover the error: it's happening in the JavaScript runtime of your choosing.
For the sake of comparison, this is what I can see when I evaluate code that throws:
------ WARNING - :fn-arity -----------------------------------------------------
Resource: <eval>:1:1
Wrong number of args (0) passed to cljs.core/identity
--------------------------------------------------------------------------------
Timeout while waiting for result.
I also get a little tooltip on the right-hand side of my buffer that says cljs.core/identity is called with 0 args but expects 1here, for instance, I can trigger a compilation error with a bogus call to cljs.core// (that's divide):
[:client] Build failure:
------ ERROR -------------------------------------------------------------------
File: /home/benl/bikeshed/cljs/niaiserie/src/main/lol/sudoscience/niaiserie/core.cljs:3:1
--------------------------------------------------------------------------------
1 | (ns lol.sudoscience.niaiserie.core
2 | (:require [lol.sudoscience.niaiserie.handlers :as h]))
3 | (/)
-------^------------------------------------------------------------------------
null
Wrong number of args (0) passed to: cljs.core//
in which case you get a line number and filename