New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clojure 1.10 breaks stacktrace handling reporting #549

Closed
slipset opened this Issue Oct 12, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@slipset
Copy link
Contributor

slipset commented Oct 12, 2018

Using Cider with Clojure-1.10 gives:

ardoq.api.survey-api> (let [2])
Syntax error macroexpanding clojure.core/let at (*cider-repl ardoq.com/ardoq-api:localhost:53859(clj)*:7015:23).
[2] - failed: even-number-of-forms? at: [:bindings] spec: :clojure.core.specs.alpha/bindings
14715723 [clojure-agent-send-off-pool-28] ERROR []  clojure.tools.nrepl.server - Unhandled REPL handler exception processing message {:op stacktrace, :pprint-fn clojure.pprint/pprint, :print-length 50, :print-level 50, :session 8442d3d0-9a9d-43d6-8693-bdde270bd4e8, :id 237} 
java.lang.NullPointerException: null
	at clojure.string$replace_first.invokeStatic(string.clj:165) ~[clojure-1.10.0-RC1.jar:na]
	at clojure.string$replace_first.invoke(string.clj:138) ~[clojure-1.10.0-RC1.jar:na]
	at cider.nrepl.middleware.stacktrace$relative_path.invokeStatic(stacktrace.clj:204) ~[na:na]
	at cider.nrepl.middleware.stacktrace$relative_path.invoke(stacktrace.clj:198) ~[na:na]
	at cider.nrepl.middleware.stacktrace$extract_location.invokeStatic(stacktrace.clj:219) ~[na:na]

According to @puredanger

Before you would have gotten the spec ExceptionInfo. Now you should get a CompilerException
wrapping that ExceptionInfo. It looks like the error is in parsing the location out of the message
(which is probably missing now as that's built later). The top-level CompilerException now
has an ex-data that reports the line number directly so no parsing is needed.

So if the code first looked for ex-data with source/line/col info then fell back to string parsing,
that would work for both:

user=> (let [2])
Syntax error macroexpanding clojure.core/let at (1:1). Cause: Call to clojure.core/let did not conform to spec.
[2] - failed: even-number-of-forms? at: [:bindings] spec: :clojure.core.specs.alpha/bindings
user=> (ex-data *e)
#:clojure.error{:line 1, :column 1, :phase :macroexpand, :source "NO_SOURCE_PATH", :symbol clojure.core/let}

^^ can just use (-> *e ex-data :clojure.error/line) now to grab the line, etc

Which would be a change somewhere around
https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/middleware/stacktrace.clj#L211

@slipset slipset changed the title Clojure 1.10 breaks error reporting Clojure 1.10 breaks stacktrace handling reporting Oct 12, 2018

slipset added a commit to slipset/cider-nrepl that referenced this issue Oct 12, 2018

slipset added a commit to slipset/cider-nrepl that referenced this issue Oct 15, 2018

@bbatsov bbatsov closed this in c6e13aa Oct 15, 2018

@jconti

This comment has been minimized.

Copy link

jconti commented Dec 18, 2018

Clojure 1.10 has been released and 0.18.0 has this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment