Fork me on GitHub
#cider
<
2019-09-06
>
danielcompton09:09:52

Is there a way to customise the way that CIDER shows the exception messages when an error is thrown? It seems to show all the information for the first exception, and only the exception class for the exception causes. It would be quite helpful if I could also have the exception message shown for all of the causes, and perhaps to not fully expand the first exception. When Integrant throws an exception during init, it provides a lot of data in the ex-data which can be a bit overwhelming. This is what I currently get

Show: Project-Only All 
  Hide: Clojure Java REPL Tooling Duplicates  (0 frames hidden)

2. Unhandled java.net.BindException

1. Caused by clojure.lang.ExceptionInfo
   Error on key :duct.server.http/aleph when building system
   {:reason :integrant.core/build-threw-exception,
    :system
       < ... 600 lines ... >
    :function #multifn[init-key 0x4f0a4cb8],
    :key :duct.server.http/aleph,
    :value {:port 8686, :handler #function[clojure.lang.AFunction/1]}}
                 core.cljc:  285  integrant.core$build_exception/invokeStatic
                 core.cljc:  284  integrant.core$build_exception/invoke
                 core.cljc:  296  integrant.core$try_build_action/invokeStatic
                  <... elided ...>
               session.clj:  171  nrepl.middleware.session/session-exec/main-loop/fn
               session.clj:  170  nrepl.middleware.session/session-exec/main-loop
                  AFn.java:   22  clojure.lang.AFn/run
               Thread.java:  834  java.lang.Thread/run
< cursor is here, right at the bottom >

danielcompton09:09:26

Here's what I'd like to have by default (I think)

Show: Project-Only All 
  Hide: Clojure Java REPL Tooling Duplicates  (0 frames hidden)

2. Unhandled java.net.BindException
   Address already in use

1. Caused by clojure.lang.ExceptionInfo
   Error on key :duct.server.http/aleph when building system

👌 1
danielcompton09:09:56

I guess a secondary feature request here would be to have more control over expanding the ex-message separately from the ex-data, or perhaps limiting how big the ex-data can be printed in the stacktrace buffer.

bozhidar11:09:36

@danielcompton Not yet. The current display was not intended and is basically the result of the changes in Clojure 1.10. I was actually planning to just strip this data from the first stack frame, as it kind of breaks the structure of the stacktrace.

bozhidar12:09:49

I think there was some ticket where we were discussing how to best handle this, I’ll have to dig it up.

tianshu16:09:43

@robertkrahn is there a huge performance drop down after suitable introduced into cider? I usually do complete by pressing TAB, when the complete menu popup, I can hardly type

robertkrahn16:09:42

@doglooksgood It depends on the speed of the repl connection / how long an eval takes. Suitable evals a code snippet so this might introduce a noticeable lag. It should only happen in interop expressions, though (e.g when typing (.| js/fooo))

robertkrahn16:09:47

We will add a switch to allow to deactivate suitable, I think. We might also consider having a timeout.

tianshu16:09:07

This happened when I type (re-frame/|)

tianshu16:09:59

Not sure if the suitable is the cause, I have upgrade cider recently

robertkrahn16:09:19

Hmm this should not trigger suitable

tianshu16:09:29

I will check with profiler

robertkrahn16:09:25

are you connected to a local browser? is there a lag when you eval an expression?

tianshu16:09:58

yes, local browser.

tianshu16:09:08

a little lag when eval an expression

robertkrahn16:09:43

OK, I will check that and whether suitable really won't get triggered for normal symbol completions (it shouldn't eval in that case but I will check). As I said, I'm pretty sure there will be a switch to disable suitable before long. Thanks for letting me know 🙂

👍 1
exit218:09:35

Error loading refactor-nrepl.middleware: java.io.FileNotFoundException: Could not locate cider/nrepl/middleware/util/cljs__init.class or cider/nrepl/middleware/util/cljs.clj on classpath., compiling:(refactor_nrepl/middleware.clj:1:1)
Exception in thread "main" java.lang.RuntimeException: Unable to resolve var: refactor-nrepl.middleware/wrap-refactor in this context, compiling:(/private/var/folders/rd/0xkr22fd1jq8y8j4856s7sy40000gp/T/form-init8061324572855299348.clj:1:2313)

exit218:09:49

I can’t seem to get my cider jack in to work, this error keeps coming up. Any ideas?

robertkrahn19:09:13

Do you have the clj-refactor Emacs package installed? In that case see https://github.com/clojure-emacs/cider/issues/2284

exit219:09:14

yeah I just removed it, and things work \o/

robertkrahn19:09:40

If you want to keep using it you can add refactor-nrepl {:mvn/version "2.5.0-SNAPSHOT"} into your user deps.edn or project deps. Even though it isn't fully compatible anymore I still can use it for various things like import cleanups and such.