Skip to content
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

repl eats the cause of exceptions #344

Closed
deaddowney opened this issue Apr 24, 2014 · 5 comments
Closed

repl eats the cause of exceptions #344

deaddowney opened this issue Apr 24, 2014 · 5 comments
Milestone

Comments

@deaddowney
Copy link

I frequently get exceptions in invoking code in the repl which don't point to the line where the error is. e.g.:

CompilerException java.lang.NullPointerException, compiling:(scenario_test.clj:100:13)
clojure.lang.Compiler$CompilerException: java.lang.NullPointerException, compiling:(scenario_test.clj:100:13)
at clojure.lang.Compiler$InvokeExpr.eval (Compiler.java:3548)
clojure.lang.Compiler$DefExpr.eval (Compiler.java:417)
clojure.lang.Compiler.eval (Compiler.java:6681)
clojure.lang.Compiler.load (Compiler.java:7103)
qfscriptz.validators_test$eval3920.invoke (form-init5484482869899311889.clj:1)
clojure.lang.Compiler.eval (Compiler.java:6676)
clojure.lang.Compiler.eval (Compiler.java:6639)
clojure.core$eval.invoke (core.clj:2927)
clojure.main$repl$read_eval_print__6625$fn__6628.invoke (main.clj:239)
clojure.main$repl$read_eval_print__6625.invoke (main.clj:239)
clojure.main$repl$fn__6634.invoke (main.clj:257)
clojure.main$repl.doInvoke (main.clj:257)
clojure.lang.RestFn.invoke (RestFn.java:1096)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__611.invoke (interruptible_eval.clj:56)
clojure.lang.AFn.applyToHelper (AFn.java:152)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.core$apply.invoke (core.clj:624)
clojure.core$with_bindings_STAR_.doInvoke (core.clj:1862)
clojure.lang.RestFn.invoke (RestFn.java:425)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:41)
clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__652$fn__655.invoke (interruptible_eval.clj:171)
clojure.core$comp$fn__4192.invoke (core.clj:2402)
clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__645.invoke (interruptible_eval.clj:138)
clojure.lang.AFn.run (AFn.java:22)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:615)
java.lang.Thread.run (Thread.java:744)

This doesn't point to any code of mine, just the compiler, which is not particularly helpful.

However, if I run the same code from my unit tests in maven, I get the cause:

Caused by: java.lang.NullPointerException
at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:26)
at qfscriptz.currency$base_ccy.invoke(currency.clj:6)
at qfscriptz.orders$limit_order.doInvoke(orders.clj:115)
at clojure.lang.RestFn.invoke(RestFn.java:512)
at qfscriptz.orders$split_child_order.doInvoke(orders.clj:171)
at clojure.lang.RestFn.invoke(RestFn.java:439)

Is Cursive (or nrepl) swallowing the cause of the exception in some cases?

@deaddowney
Copy link
Author

When this occurs, a workaround is to put this in the REPL:

(.printStackTrace (.getCause *e))

Now, can we get Cursive to do this for us?

@cursive-ide
Copy link
Owner

We should be able to! I'll fix this for the next release, assuming nREPL actually passes the right data back. If not, it might be a little trickier.

@cursive-ide cursive-ide added this to the 0.1.23 milestone Apr 26, 2014
@cursive-ide
Copy link
Owner

BTW I'm assuming that you're referring here to the exception printed by the "Print Last Exception" button, correct?

@deaddowney
Copy link
Author

Correct.

@cursive-ide
Copy link
Owner

Thanks. This is fixed in the next build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants