dev-tooling

mauricio.szabo 2024-01-04T22:15:17.059279Z

Folks, for nREPL: what exactly is nrepl.middleware.caught/caught? Basically, what I am trying to do, is to avoid printing to stderr when some exception happens - is it possible? Am I on the right track, or should I be doing something completely different?

2024-01-05T00:02:13.629549Z

I never used that caught middleware but from looking at the code, if that middleware is loaded then for every exception clojure.main/repl-caught will be called unless nrepl.middleware.caught/**caught-fn** is bound to something else. clojure.main/repl-caught will print to std-err. So I guess you can set that to nil like (set! nrepl.middleware.caught/*caught-fn* nil) and it shouldn't print to std-serr

2024-01-05T00:05:38.762149Z

Or just print to std-out with (set! nrepl.middleware.caught/*caught-fn* (fn [e] (println "ERROR ----" e)))

mauricio.szabo 2024-01-05T00:16:04.605309Z

Yes, that was what I found too. Unfortunately, seems that not all implementations honor this key, so I'm not sure it'll be useful for me 😞

2024-01-05T00:17:47.376079Z

not sure I follow, wdym? I tried it on my cider setup, replacing the cought-fn and seams to work

mauricio.szabo 2024-01-05T00:18:09.842779Z

Babashka still prints to stderr, for example, when an exception happens

2024-01-05T00:18:25.677899Z

oh I see bb, ok

mauricio.szabo 2024-01-05T00:30:15.569609Z

Yeah, nREPL implementations I meant 😄