Chris Murphy
Chris Murphy

Reputation: 6509

View stack traces in Cursive REPL

I am developing a Clojure program from a REPL in Cursive. I would like to see stack traces with the error messages. By default it seems that only the error message is output.

If I 'Edit Configurations...' I can see that the REPL is a 'Clojure REPL' and that 'Use clojure.main in normal JVM process' is specified. I believe this is a fairly standard REPL setup with Cursive.

All the clojure source files are in the user namespace, and there is nothing special about the project.clj lein project file.

Currently if I want to see a stack trace I need to run the program like this:

(use 'clojure.stacktrace)
(x)
(print-stack-trace *e 30)

Here (x) is running the program that is crashing. These steps work from both the command line (starting off with lein repl) and from within the Cursive REPL.

Are there some setup steps that I can do so that stack traces are always shown with error messages and so (use 'clojure.stacktrace) and (print-stack-trace *e 30) become superfluous?

Upvotes: 2

Views: 839

Answers (1)

Pankov
Pankov

Reputation: 101

You can add a keymap to "Print last exception" menu item. Open the settings with ⌘, then access Keymap > Main Menu > Tools > REPL. Double click "Print last exception" and choose a shortcut. my settings

Upvotes: 2

Related Questions