calva icon indicating copy to clipboard operation
calva copied to clipboard

The functions which caused an exception are sometimes omitted from the stacktrace

Open guyguy2001 opened this issue 1 year ago • 4 comments

I just had an exception while running some functions in the REPL (via alt-enter), and the relevant functions in my code that actually caused the exception weren't show in the stack-trace calva gave me.

I took a look at #2029, but it seems like there the relevant functions were actually printed, so I believe this isn't a duplicate.

When running this, I get a stack trace which claims that the exception occured in clojure-adventure.vec2/-apply-items, but it doesn't show in the stack trace: image image

However, if I wrap it in a try/catch, I can see -apply-items and the functions that called it in the stack trace: image

I have since found and fixed the error, and found that it was a relatively boring "everything was nil and so the function crashed", no special macros or anything - so I have no idea why the stacktrace acted weirdly.

My settings

  "calva.paredit.defaultKeyMap": "strict",
  "[.cljs]": {
    "editor.defaultFormatter": "betterthantomorrow.calva"
  },
  "calva.useLegacyReplWindowPath": false,
  "calva.autoOpenREPLWindow": true,
  "calva.outputDestinations": {
    "evalResults": "terminal",
    "evalOutput": "terminal",
    "otherOutput": "terminal"
  },
  "calva.highlight.commentFormStyle": {},

Running this yourself

I have a reproducible (for me) version of this at https://github.com/guyguy2001/clojure-adventure in the calva-reproduction/stacktrace tag.

Connect to the repl (using the default lein profile), go to src\clojure_adventure\fiddles\ui_fiddle.clj, and ctrl-click the sections after 1. and 3. to get the weird behvaiour, or 1. and 2. to get the actual stack trace.

image

I could make a lighter reproduction if it's needed, but I'll wait for an initial opinion of the issue (e.g. is this a silly dup or user error) before putting time into it

guyguy2001 avatar Oct 04 '24 19:10 guyguy2001

Hello! Sorry for belated reply, I almost missed this issue for some reason.

Calva does some filtering on the stacktrace before printing it:

https://github.com/BetterThanTomorrow/calva/blob/dev/src/repl-window/repl-doc.ts#L466

I don't know why that item should fall victim to the filter, but it's either that, or Calva never sees that item. I can have a look, but it could be more effective if you check it out. I don't recall if you have run Calva in development or not. Please let me know if you wanna have a go at it and if you need any pointers. Otherwise I'll have a look.

PEZ avatar Oct 07 '24 19:10 PEZ

I'll try to give it a look over the weekend - I'll tell you how it goes and if I need help running stuff

guyguy2001 avatar Oct 07 '24 20:10 guyguy2001

Awesome! We keep the docs for how to get the dev environment up and running in the wiki. (You probably knew, but anyway 😄)

PEZ avatar Oct 07 '24 22:10 PEZ

just want to add that I get this a lot as well.

I need run "e*" often in the repl, due to this.

behrica avatar Jan 14 '25 21:01 behrica