cider
cider copied to clipboard
`cider-load-buffer` eats up NodeJS top-level exceptions
Expected behavior
cider-load-buffer
should report any top-level exceptions
Actual behavior
eval-last-sexp
on e.g. (cons 1 2)
will correctly report an error, while cider-load-buffer
with the same expression at top-level will simply ignore it and report nothing.
Steps to reproduce the problem
cider-jack-in-cljs
with Node repl
(ns main
(:require
[cljs.nodejs :as node]
[cljs.pprint :as pp]))
(cons 1 2)
cider-eval-last-sexp
will correctly report not ISeqable error when evaluating that (cons ...)
, however cider-load-buffer
will happily run till completion completely ignoring any such errors.
We can confirm error is thrown and can be caught by wrapping that cons
in (try (cons 1 2) (catch :default e (println :foo)))
then cider-load-buffer
will print :foo
.
My best guess is that default cider-load-file-handler
for Node does or doesn't do something here? Not sure.
Environment & Version information
Reproduced
CIDER version information
;; CIDER 1.2.0 (Nice), nREPL 0.9.0
;; Clojure 1.10.3, Java 17.0.1
Lein/Boot version
Emacs version
27.2 and 28.0.50
Operating system
Mac OSX 11.6.2 Big Sur Latest Guix SD
I'm guessing it's something to do with https://github.com/nrepl/piggieback/pull/98 I guess someone like @dpsutton would be more knowledgeable on the topic.
Hm, sounds close enough however let me point out again that wrapping in (try ... catch)
the same expression that throws results in said exception being reported which tells me that the wrapped expression is being evaled despite not being the first. And in fact this code cider-load-buffer
handles just fine i.e. I'm not seeing what the linked issue reports: all forms are evaluated.
(println "f1")
(defn f1 [] 1)
(println "f2")
(defn f2 [] 2)
Then I'm not convinced it is the same issue. Sounds more like top-level exceptions are being thrown away but all forms actually evaluate.
It would've been the same issue if nrepl
or whoever actually does eval amounted to dumping strings into repl-stdin a-la comint
mode.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!