Formatting Errors for clarity

io.aviso/pretty is a library to highlight the most important error lines from a potentially long stack trace.

Pretty error output features

  • Readable output for exceptions
  • ANSI font and background color support
  • Hex dump of binary data
  • Hex dump of binary deltas
  • Formatting data into columns

Pretty print of error messages with iv.aviso/pretty

In the REPL

io.aviso.repl namespace contains functions for use in the REPL, which can copy stack traces from the system clipboard.

(install-pretty-exceptions) function overrides several internal Clojure functions to enable formatted exceptions using io.aviso.exception/write-exception

(pretty-print) parses the content of the clipboard as EDN and prints it in human readable form

(format-exception) parse the stack trace and format it for readability

Add the following in a comment block, typically in a dev/user.clj file or namespace that is generating a noticeable number of stack traces.

(comment
  (require '[io.aviso.repl as pretty])

  (-> (pretty/copy)
      pretty/format-exception
      pretty/paste)
)

On the command line

AvisoNovate/pretty can be used as a Leiningen plugin for command line use

Add pretty as a profile to the project.clj or users .profiles.clj

lein with-profiles +pretty run

results matching ""

    No results matching ""