clojure-emacs / clojure-emacs/cider
`cider-load-buffer` eats up NodeJS top-level exceptions
- Dominant language
- Emacs Lisp
- Stars
- 3.7k
- Forks
- 651
- Avg merge
- 11h 6m
- Merged PRs (30d)
- 33
Description
## 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
```lisp
(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
Contributor guide
Research direction
Start by reproducing the issue with the provided cider-jack-in-cljs Node REPL example and compare cider-load-buffer with cider-eval-last-sexp. Inspect the default cider-load-file-handler for Node and the surrounding cider-load-buffer handling. Done means top-level exceptions such as the cons error are reported instead of being silently ignored.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure, emacs-lisp, node.js
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100