Dealing with Errors

Every now and then you’ll make some mistake in your code which is going to result in an evaluation error. Clojure’s errors are notorious for their complexity and CIDER takes a lot of effort to make it easier to decipher those.

Most of the time CIDER will display the errors in a dedicated buffer alongside the buffer you’re currently evaluating code in.

Use q to quickly close an error buffer.

Configuration

By default, when an exception occurs, CIDER will display the exception in an error buffer using cider-stacktrace-mode. You can suppress this behavior, which causes just the error message to be output as a temporary overlay or in the echo area:

(setq cider-show-error-buffer nil)

Starting from CIDER 1.8.0, only runtime exceptions (and not compilation errors) will cause a stacktrace buffer to be shown. This better follows Clojure 1.10’s intended semantics. This behavior is controlled by the cider-clojure-compilation-error-phases configuration option. If you wish for the error phase to be ignored, and to only take cider-show-error-buffer into account, please customize:

(setq cider-clojure-compilation-error-phases nil)

At times, the error being displayed will originate from a bug in CIDER itself. These internal errors might frequently occur and interrupt your workflow, but you might not want to suppress all stacktrace buffers by using cider-show-error-buffer. Instead, you might only want to suppress this specific type of internal error. The stacktrace buffers provide such an option when displaying an internal error. A toggle button will be displayed with the error type’s name, and you can toggle whether this particular type of error will cause the stacktrace buffer to automatically show itself. The toggle button controls this behavior only during the current Emacs session, but if you would like to make the suppression more permanent, you can do so by customizing the cider-stacktrace-suppressed-errors variable. The buffer will also provide a direct link to the bug reporting page to help facilitate its diagnosis and repair.

Independently of the value of cider-show-error-buffer or cider-stacktrace-suppressed-errors, CIDER always generates the error buffer in the background. You can use cider-selector (C-c M-s) to visit this buffer if you decide that you need to.