Releases: clj-commons/pretty
Improved Documentation
This release primarily improves the function docstrings, leveraging the latest features of Codox.
One minor change was to the standard stack frame filter, which now omits stack frames from the sun.reflect
package (or sub-packages).
No issues were fixed in this release.
Stack Frame Filtering
It is now possible to specify a filter for the stack frames in the exception report; frames can be hidden (in which case they are not displayed at all), or omitted. Consecutive omitted frames are reduced down to a single ellipsis. This can remove significant clutter from the exception report, making it that much easier to identify the true cause.
For write-exception
and format-exception
there is no default filter.
For exceptions added via io.aviso.repl/install-pretty-exceptions
, the filtering omits frames from the clojure.lang
package, and terminates output when the frames for the REPL are reached.
For comparison, this is the filtered output produced via clojure.repl/pst
:
java.lang.RuntimeException: Request handling exception
java.lang.RuntimeException: Failure updating row
java.sql.SQLException: Database failure
SELECT FOO, BAR, BAZ
FROM GNIP
failed with ABC123
SQLState: "ABC"
errorCode: 123
user/jdbc-update user.clj: 7
user/make-jdbc-update-worker/reify/do-work user.clj: 18
user/update-row user.clj: 23
user/make-exception user.clj: 31
user/eval1399 form-init1706920952124877859.clj: 1
...
clojure.core/eval core.clj: 2927
This is the full output from write-exception
:
java.lang.RuntimeException: Request handling exception
java.lang.RuntimeException: Failure updating row
java.sql.SQLException: Database failure
SELECT FOO, BAR, BAZ
FROM GNIP
failed with ABC123
SQLState: "ABC"
errorCode: 123
user/jdbc-update user.clj: 7
user/make-jdbc-update-worker/reify/do-work user.clj: 18
user/update-row user.clj: 23
user/make-exception user.clj: 31
user/eval1399 form-init1706920952124877859.clj: 1
clojure.lang.Compiler.eval Compiler.java: 6703
clojure.lang.Compiler.eval Compiler.java: 6666
clojure.core/eval core.clj: 2927
clojure.main/repl/read-eval-print/fn main.clj: 239
clojure.main/repl/read-eval-print main.clj: 239
clojure.main/repl/fn main.clj: 257
clojure.main/repl main.clj: 257
clojure.lang.RestFn.invoke RestFn.java: 1096
clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn interruptible_eval.clj: 56
clojure.lang.AFn.applyToHelper AFn.java: 152
clojure.lang.AFn.applyTo AFn.java: 144
clojure.core/apply core.clj: 624
clojure.core/with-bindings* core.clj: 1862
clojure.lang.RestFn.invoke RestFn.java: 425
clojure.tools.nrepl.middleware.interruptible-eval/evaluate interruptible_eval.clj: 41
clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn interruptible_eval.clj: 171
clojure.core/comp/fn core.clj: 2402
clojure.tools.nrepl.middleware.interruptible-eval/run-next/fn 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: 724
Note: The signatures of the format-exception
and write-exception
functions have changed; the optional last parameter is now a simple map, rather than a variable number of key/value pairs.
REPL improvements
This release addresses some minor performance issues related to using the REPL.
Pretty Tests
The main change in this release is that the functions used by clojure.test
to output exceptions are now hooked to use pretty to format the exceptions.
In addition, you now have greater control over exception output: whether properties are displayed, and an optional limit on the number of stack frames listed.
REPL support
This quick release adds new namespaces for automatically enabling pretty exception reporting when using nREPL via Leiningen. It's easy to use even if you aren't using Leiningen.
ASCII output for write-binary
Added new abilities to output binary data with a companion ASCII column, and control the number of bytes per line.
Let's do columns!
This release breaks out the columns support (used by the exception report) into its own namespace.
The ANSI namespace adds adds support for inverse output, as well as strip-ansi
to remove the ANSI codes from a string.
The exception report has been re-formatted to take up less horizontal space.
Minor improvements
This version does a better job of indenting multi-line error messages for exceptions.
It demangles the names of reified classes (using the same logic as Clojure function names).
Error properties are now indented much less, allowing more room for the values.
Pretty printing
Along with a number of documentation cleanups and some refactoring of the Writer protocol, this release adds pretty-printing of the properties associated with each exception.
Minor improvements
This release primarily refactors out write-
methods from the original format-
methods. This makes it easier to directly write formatted data to a java.lang.Writer
or java.lang.StringBuilder
.