Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cider-load-buffer eats up NodeJS top-level exceptions #3144

Open
vkz opened this issue Jan 30, 2022 · 3 comments
Open

cider-load-buffer eats up NodeJS top-level exceptions #3144

vkz opened this issue Jan 30, 2022 · 3 comments

Comments

@vkz
Copy link

vkz commented Jan 30, 2022

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

@bbatsov
Copy link
Member

bbatsov commented Feb 13, 2022

I'm guessing it's something to do with nrepl/piggieback#98 I guess someone like @dpsutton would be more knowledgeable on the topic.

@vkz
Copy link
Author

vkz commented Feb 15, 2022

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.

@stale
Copy link

stale bot commented Jun 13, 2022

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!

@stale stale bot added the stale label Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants