Unrepl/unrepl

1.8.0 or below: Throwable->map not readable

pesterhazy opened this issue · 2 comments

In Clojure 1.9 Throwable->map produces a readable map, i.e. a map containing only Clojure data structures

However, on 1.8, it contains java objects (classes, stack trace frames).

This makes it hard to write clients compatible with both versions.

A link to the release notes: https://github.com/clojure/clojure/blob/master/changes.md#33-other-fixes

Ideally this would be fixed in unrepl, by plugging in a fixed version of Throwable->map on versions below 1.9.0

unrepl :exception output for 1.8.0

[:exception
 {:ex #error {:cause "Wrong number of args (0) passed to: core//",
              :via [{:type #unrepl.java/class clojure.lang.ArityException, :message "Wrong number of args (0) passed to: core//", :at #unrepl/object [#unrepl.java/class java.lang.StackTraceElement "0x34fecd3d" "clojure.lang.AFn.throwArity(AFn.java:429)" {#unrepl/... nil #unrepl/... {:get (unrepl.replG__571/fetch :G__2030), :print-settings {:unrepl.print/string-length 9223372036854775807, :unrepl.print/coll-length 0, :unrepl.print/nesting-depth 8}}}]}],
              :trace [#unrepl/object [#unrepl.java/class java.lang.StackTraceElement "0x34fecd3d" "clojure.lang.AFn.throwArity(AFn.java:429)" {:bean {#unrepl/... nil #unrepl/... {:get (unrepl.replG__571/fetch :G__2032), :print-settings {:unrepl.print/string-length 9223372036854775807, :unrepl.print/coll-length 0, :unrepl.print/nesting-depth 8}}}}]
                      #unrepl/object [#unrepl.java/class java.lang.StackTraceElement "0x1e0c959e" "clojure.lang.RestFn.invoke(RestFn.java:399)" {:bean {#unrepl/... nil #unrepl/... {:get (unrepl.replG__571/fetch :G__2034), :print-settings {:unrepl.print/string-length 9223372036854775807, :unrepl.print/coll-length 0, :unrepl.print/nesting-depth 8}}}}]
                      #unrepl/object [#unrepl.java/class java.lang.StackTraceElement "0x62e4496b" "user$eval2027.invokeStatic(unrepl-session:4)" {:bean {#unrepl/... nil #unrepl/... {:get (unrepl.replG__571/fetch :G__2036), :print-settings {:unrepl.print/string-length 9223372036854775807, :unrepl.print/coll-length 0, :unrepl.print/nesting-depth 8}}}}]
                      #unrepl/object [#unrepl.java/class java.lang.StackTraceElement "0x5bcfdc0b" "user$eval2027.invoke(unrepl-session:4)" {:bean {#unrepl/... nil #unrepl/... {:get (unrepl.replG__571/fetch :G__2038), :print-settings {:unrepl.print/string-length 9223372036854775807, :unrepl.print/coll-length 0, :unrepl.print/nesting-depth 8}}}}]
                      #unrepl/object [#unrepl.java/class java.lang.StackTraceElement "0xcb5ff2d" "clojure.lang.Compiler.eval(Compiler.java:6927)" {:bean {#unrepl/... nil #unrepl/... {:get (unrepl.replG__571/fetch :G__2040), :print-settings {:unrepl.print/string-length 9223372036854775807, :unrepl.print/coll-length 0, :unrepl.print/nesting-depth 8}}}}]
                      #unrepl/object [#unrepl.java/class java.lang.StackTraceElement "0x63fbc3e9" "clojure.lang.Compiler.eval(Compiler.java:6890)" {:bean {#unrepl/... nil #unrepl/... {:get (unrepl.replG__571/fetch :G__2042), :print-settings {:unrepl.print/string-length 9223372036854775807, :unrepl.print/coll-length 0, :unrepl.print/nesting-depth 8}}}}]
                      #unrepl/object [#unrepl.java/class java.lang.StackTraceElement "0x5adeaab6" "clojure.core$eval.invokeStatic(core.clj:3105)" {:bean {#unrepl/... nil #unrepl/... {:get (unrepl.replG__571/fetch :G__2044), :print-settings {:unrepl.print/string-length 9223372036854775807, :unrepl.print/coll-length 0, :unrepl.print/nesting-depth 8}}}}]
                      #unrepl/object [#unrepl.java/class java.lang.StackTraceElement "0x1b603ab5" "clojure.core$eval.invoke(core.clj:3101)" {:bean {#unrepl/... nil #unrepl/... {:get (unrepl.replG__571/fetch :G__2046), :print-settings {:unrepl.print/string-length 9223372036854775807, :unrepl.print/coll-length 0, :unrepl.print/nesting-depth 8}}}}]
                      #unrepl/object [#unrepl.java/class java.lang.StackTraceElement "0x7ab21665" "unrepl.replG__571$start$interruptible_eval__985$fn__986$fn__987$fn__988.invoke(NO_SOURCE_FILE:706)" {:bean {#unrepl/... nil #unrepl/... {:get (unrepl.replG__571/fetch :G__2048), :print-settings {:unrepl.print/string-length 9223372036854775807, :unrepl.print/coll-length 0, :unrepl.print/nesting-depth 8}}}}]
                      #unrepl/object [#unrepl.java/class java.lang.StackTraceElement "0x6b21404c" "clojure.lang.AFn.applyToHelper(AFn.java:152)" {:bean {#unrepl/... nil #unrepl/... {:get (unrepl.replG__571/fetch :G__2050), :print-settings {:unrepl.print/string-length 9223372036854775807, :unrepl.print/coll-length 0, :unrepl.print/nesting-depth 8}}}}]
                      #unrepl/... {:get (unrepl.replG__571/fetch :G__2051)}]},
  :phase :eval} 3]

unrepl :exception output for 1.9.0

[:exception
 {:ex #error {:cause "Wrong number of args (0) passed to: core//",
              :via [{:type clojure.lang.ArityException, :message "Wrong number of args (0) passed to: core//", :at [clojure.lang.AFn throwArity "AFn.java" 429]}],
              :trace [[clojure.lang.AFn throwArity "AFn.java" 429]
                      [clojure.lang.RestFn invoke "RestFn.java" 399]
                      [user$eval22221 invokeStatic "unrepl-session" 3]
                      [user$eval22221 invoke "unrepl-session" 3]
                      [clojure.lang.Compiler eval "Compiler.java" 7062]
                      [clojure.lang.Compiler eval "Compiler.java" 7025]
                      [clojure.core$eval invokeStatic "core.clj" 3206]
                      [clojure.core$eval invoke "core.clj" 3202]
                      [unrepl.replG__21703$start$interruptible_eval__22133$fn__22134$fn__22135$fn__22136 invoke "NO_SOURCE_FILE" 706]
                      [clojure.lang.AFn applyToHelper "AFn.java" 152]
                      #unrepl/... {:get (unrepl.replG__21703/fetch :G__22223)}]},
  :phase :eval} 3]