Fork me on GitHub
#cider
<
2019-09-27
>
pez10:09:17

What would CIDER do? (A question I often ask, when hacking on Calva). Right now I don't have Emacs handy, though, so here goes. What does CIDER do when you evaluate to comment and an error is thrown?

rickmoynihan12:09:03

;; => is what I get 😐

rickmoynihan12:09:55

When running M-x cider-pprint-eval-last-sexp-to-comment on (throw (ex-info "foo" {}))

pez12:09:16

Thanks! It is sort of true. But I think I'll try to include some little more info. 😃

rickmoynihan12:09:26

Yes it is… I also get the *cider-error* buffer pop up — not sure if configuring it differently would change the behaviour though

pez13:09:34

I'm looking at how to support the Design Journal that @jr0cket mentioned in the ClojureScript podcast better. Then it makes sense to include some of the error message in the comment, me thinks.

❤️ 4
bozhidar13:09:45

@rickmoynihan That’s definitely a bug. 🙂 It’d be nice if you reported it. I think nothing should be printed in the comment at all in such cases and users should just get the error buffer.

pez14:09:18

> I think nothing should be printed in the comment at all in such cases and users should just get the error buffer. That's what Calva does today. 😀 But it makes a boring design journal.

bozhidar14:09:58

I’ve got no issues with boring. Printing the condensed error message is always an option, but it seems pointless to me if you get a stacktrace buffer alongside anyways.

pez14:09:14

It is in the design journal context that I think it is not pointless: https://github.com/jr0cket/tictactoe-reagent/blob/master/src/tictactoe_reagent/core.cljs

practicalli-johnny14:09:31

I will sometimes copy the most interesting part of an error message to a comment under the expressions

practicalli-johnny14:09:21

Especially of it's a useful learning experience or a common error the team experiences

yuhan14:09:18

somewhat related, but I'd actually like it if there was an option to display error messages in the result overlay without popping up an error buffer

yuhan14:09:29

90% of the time it's a simple typo and I don't need to see the entire stacktrace and spend half a second dismissing the popup window

practicalli-johnny15:09:49

@qythium what you ask for is what I use clj-kondo for, it picks up typos and many other errors and warnings. It works as a backend to flycheck

yuhan16:09:30

Yeah, I use flycheck-clj-kondo also, but it doesn't pick up on everything (eg. "typos" where I pass arguments in the wrong order)

yuhan16:09:24

just hacked together a prototype to try out over the next few days and see if it's a good idea 🙂

bozhidar21:09:08

@qythium I like the idea. Feel free to send a PR.

bozhidar21:09:00

I guess the only thing we need to consider is how to summon the stacktrace buffer in those cases, as I assume we won’t be showing it if we are relying on the overlay to communicate the error.