Fork me on GitHub

Is there any way to get cider to show (.printStackTrace error)'s result in other threads as a normal stacktrace?


I don't like having to look at the repl to see the error.


I’ve not been able to see logs in cider. This is using cider-nrepl 0.17.0-SNAPSHOT. My application is logging to STDOUT. There’s no *nrepl-server* buffer or anything similar. How might I go about debugging this? I know that the application is logging correctly. The logs show up when I run code in the Cursive REPL. Note that I’m quite ignorant when it comes to emacs things. Side by side, is there a way to tell cider not to use SNAPSHOT versions of cider-nrepl?


@jumblemuddle I’m not sure I’m understanding the problem you have and what you want to achieve.


@jysandy Generally such logs end up in the nrepl-server buffer and should also be doubled in your REPL. Are you on the most recent snapshot? Well, if you don’t use snapshot versions of cider-nrepl with a snapshot version of CIDER, it’s not going to work. 🙂 You can always use some repo like melpa-stable and the latest stable release instead.


@bozhidar Cider only handles errors that are bubbled up to the main thread (I assume this has something to do with the way the nrepl middleware is setup.) Is there a way to get it to handle/pretty-print stacktraces that are printed from other threads? Unfortunately there isn't a good way for me to get the errors to be thrown on the main thread, so I have to resort to (try ... (catch Exception e (.printStackTrace e))) at the moment.


I can't think of a way right now, but I could think of some magical ways to do it... 🤔


Haha, if you've got some wizardry that'd be cool. It's really only a problem, because I'm diving into the messy world of ugly java libraries.


a minimumly viable way to do it: (catch Exception e (def crap-an-error e)) (or use an atom or something mutable) and then from the repl, just do (throw crap-an-error)


Oh, catch errors and set them in a watched atom or something is an idea.


Cider could add a tag for this, but I've not thought much about that


but I'm just guessing


Yeah, similar code transformation could take place to catch the exn


Or setting an unhandled exception handler


Thanks for the suggestion, @tanzoniteblack. I've gone ahead with (catch Exception e (reset! error e)) then I just evaluate #_(throw @error) when I need to see the error. It's not pretty, but it works alright.