I found when working on ticket 191 (dead now, I suppose) that counting the
stack elements is not reliable, but = works to get rid of duplicates. Below
you can compare java's to your new function - the clojure has one duplicate
element (the very last one). Also, I find the "..." useful to know
something is cut off.
root-cause is too generic of a name since it only strips out
CompileException.
Will clojure.stacktrace be deprecated or patched to use this implementation?
My patch for 191 includes test code if you want to adjust it for this.
-Mike
user=> (.printStackTrace *e)
java.lang.Exception: Unable to resolve symbol: x in this context,
compiling:(NO_SOURCE_FILE:0)
at clojure.lang.Compiler.analyze(Compiler.java:5777)
at clojure.lang.Compiler.analyze(Compiler.java:5723)
at clojure.lang.Compiler.eval(Compiler.java:6002)
at clojure.lang.Compiler.eval(Compiler.java:5965)
at clojure.core$eval.invokeStatic(core.clj:2652)
at clojure.core$eval.invoke(core.clj)
at clojure.main$repl$read_eval_print__5766.invoke(main.clj:177)
at clojure.main$repl$fn__5771.invoke(main.clj:198)
at clojure.main$repl.doInvoke(main.clj:198)
at clojure.lang.RestFn.invoke(RestFn.java:422)
at clojure.main$repl_opt.invoke(main.clj:256)
at clojure.main$main.doInvoke(main.clj:349)
at clojure.lang.RestFn.invoke(RestFn.java:398)
at clojure.lang.Var.invoke(Var.java:361)
at clojure.lang.AFn.applyToHelper(AFn.java:159)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.main.main(main.java:37)
Caused by: java.lang.Exception: Unable to resolve symbol: x in this context
at clojure.lang.Compiler.resolveIn(Compiler.java:6251)
at clojure.lang.Compiler.resolve(Compiler.java:6195)
at clojure.lang.Compiler.analyzeSymbol(Compiler.java:6158)
at clojure.lang.Compiler.analyze(Compiler.java:5744)
... 16 more
nil
user=> (pst *e 40)
CompilerException java.lang.Exception: Unable to resolve symbol: x in this
context, compiling:(NO_SOURCE_FILE:0)
clojure.lang.Compiler.analyze (Compiler.java:5777)
clojure.lang.Compiler.analyze (Compiler.java:5723)
clojure.lang.Compiler.eval (Compiler.java:6002)
clojure.lang.Compiler.eval (Compiler.java:5965)
clojure.core/eval (core.clj:2652)
clojure.core/eval (core.clj:-1)
clojure.main/repl/read-eval-print--5766 (main.clj:177)
clojure.main/repl/fn--5771 (main.clj:198)
clojure.main/repl (main.clj:198)
clojure.main/repl-opt (main.clj:256)
clojure.main/main (main.clj:349)
clojure.lang.Var.invoke (Var.java:361)
clojure.lang.Var.applyTo (Var.java:482)
clojure.main.main (main.java:37)
Caused by:
Exception Unable to resolve symbol: x in this context
clojure.lang.Compiler.resolveIn (Compiler.java:6251)
clojure.lang.Compiler.resolve (Compiler.java:6195)
clojure.lang.Compiler.analyzeSymbol (Compiler.java:6158)
clojure.lang.Compiler.analyze (Compiler.java:5744)
clojure.lang.Compiler.analyze (Compiler.java:5723)
nil
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en