You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code raises a java.lang.ArithmeticException with an one-element stack trace that clj-stacktrace.repl/find-source-width can't handle, so an IndexOutOfBoundsException is raised when trying to print it. Versions used: [clj-stacktrace "0.2.6"] and [org.clojure/tools.trace "0.7.5"].
(try
(clojure.tools.trace/trace-forms
(let [a (+ 1 1)
b (* 2 2)
c (* a b (/ 4 0))]
c))
(catch Exception e
;; this will throw IndexOutOfBoundsException:
(clj-stacktrace.repl/pst-on *err* false e)
))
clojure.tools.trace/trace-forms creates an exception with a single element in his stacktrace (check clojure.tools.trace/trace-compose-exception). When this exception is parsed by clj-stacktrace.core/parse-exception you get something like this:
{:class java.lang.ArithmeticException,
:message "Divide by zero\n Form failed: (/ 4 0)\n Form failed: (* a b (/ 4 0))\n Form failed: (let* [a (+ 1 1) b (* 2 2) c (* a b (/ 4 0))] c)\n Form failed: (let [a (+ 1 1) b (* 2 2) c (* a b (/ 4 0))] c)\n",
:trace-elems ({:method "divide",
:class "clojure.lang.Numbers",
:java true,
:file "Numbers.java", :line 156})}
but clj-stacktrace.utils/quartile3 is BROKEN for one-element collections, so when is called (after pst-on -> find-source-width -> utils/fence) it fails on the following expression:
But the @jonpither fix in that ticket didn't resolved this problem. It happens in clj-stacktrace 0.2.5 before the fix and after the fix was merged in 0.2.6.
The text was updated successfully, but these errors were encountered:
The following code raises a
java.lang.ArithmeticException
with an one-element stack trace thatclj-stacktrace.repl/find-source-width
can't handle, so anIndexOutOfBoundsException
is raised when trying to print it. Versions used:[clj-stacktrace "0.2.6"]
and[org.clojure/tools.trace "0.7.5"]
.clojure.tools.trace/trace-forms
creates an exception with a single element in his stacktrace (checkclojure.tools.trace/trace-compose-exception
). When this exception is parsed byclj-stacktrace.core/parse-exception
you get something like this:but
clj-stacktrace.utils/quartile3
is BROKEN for one-element collections, so when is called (afterpst-on -> find-source-width -> utils/fence
) it fails on the following expression:Simple test:
I think this bug is related to the following closed ticket:
#20
But the @jonpither fix in that ticket didn't resolved this problem. It happens in clj-stacktrace
0.2.5
before the fix and after the fix was merged in0.2.6
.The text was updated successfully, but these errors were encountered: