@@ -9,6 +9,7 @@ Thats what _pretty_ is for. It adds support for pretty output where it counts:
9
9
* Hex dump of binary data
10
10
* Hex dump of binary deltas
11
11
* Readable output for exceptions
12
+ * Formatting data into columns
12
13
13
14
pretty is released under the terms of the Apache Software License 2.0.
14
15
@@ -94,44 +95,46 @@ This is best explained by example; here's a `SQLException` wrapped inside two `R
94
95
95
96
```
96
97
(.printStackTrace e)
97
- => nil
98
98
java.lang.RuntimeException: Request handling exception
99
- at user$make_exception.invoke(user.clj:6)
100
- at clojure.lang.AFn.applyToHelper(AFn.java:159)
101
- at clojure.lang.AFn.applyTo(AFn.java:151)
102
- at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3458)
103
- at clojure.lang.Compiler$DefExpr.eval(Compiler.java:408)
104
- at clojure.lang.Compiler.eval(Compiler.java:6624)
99
+ at user$make_exception.invoke(user.clj:30)
100
+ at user$eval1322.invoke(NO_SOURCE_FILE:1)
101
+ at clojure.lang.Compiler.eval(Compiler.java:6619)
105
102
at clojure.lang.Compiler.eval(Compiler.java:6582)
106
103
at clojure.core$eval.invoke(core.clj:2852)
107
104
at clojure.main$repl$read_eval_print__6588$fn__6591.invoke(main.clj:259)
108
105
at clojure.main$repl$read_eval_print__6588.invoke(main.clj:259)
109
106
at clojure.main$repl$fn__6597.invoke(main.clj:277)
110
107
at clojure.main$repl.doInvoke(main.clj:277)
111
108
at clojure.lang.RestFn.invoke(RestFn.java:1096)
112
- at clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__876 .invoke(interruptible_eval.clj:56)
109
+ at clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__808 .invoke(interruptible_eval.clj:56)
113
110
at clojure.lang.AFn.applyToHelper(AFn.java:159)
114
111
at clojure.lang.AFn.applyTo(AFn.java:151)
115
112
at clojure.core$apply.invoke(core.clj:617)
116
113
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1788)
117
114
at clojure.lang.RestFn.invoke(RestFn.java:425)
118
115
at clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke(interruptible_eval.clj:41)
119
- at clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__917$fn__920 .invoke(interruptible_eval.clj:171)
116
+ at clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__849$fn__852 .invoke(interruptible_eval.clj:171)
120
117
at clojure.core$comp$fn__4154.invoke(core.clj:2330)
121
- at clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__910 .invoke(interruptible_eval.clj:138)
118
+ at clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__842 .invoke(interruptible_eval.clj:138)
122
119
at clojure.lang.AFn.run(AFn.java:24)
123
- at java.util.concurrent.ThreadPoolExecutor$Worker.runTask (ThreadPoolExecutor.java:886 )
124
- at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908 )
125
- at java.lang.Thread.run(Thread.java:680 )
120
+ at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1110 )
121
+ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603 )
122
+ at java.lang.Thread.run(Thread.java:722 )
126
123
Caused by: java.lang.RuntimeException: Failure updating row
127
- ... 27 more
124
+ at user$update_row.invoke(user.clj:22)
125
+ ... 24 more
128
126
Caused by: java.sql.SQLException: Database failure
129
- ... 27 more
127
+ SELECT FOO, BAR, BAZ
128
+ FROM GNIP
129
+ failed with ABC123
130
+ at user$jdbc_update.invoke(user.clj:6)
131
+ at user$make_jdbc_update_worker$reify__214.do_work(user.clj:17)
132
+ ... 25 more
130
133
```
131
134
132
135
... and here's the equivalent, via ` write-exception ` :
133
136
134
- ![ ] ( https://www.evernote.com/shard/s54/sh/ad94a14b-2107-4183-ab4a-3796a6225ea9/9295ec6d8acea581d2e0d7463026618c /deep/0/README.md----pretty----pretty------workspaces-annadale-pretty-.png )
137
+ ![ ] ( https://www.evernote.com/shard/s54/sh/9df8600b-adf2-4605-8298-48d78aa93dd7/e0fccbe84d3de74091ccc0fc3c70d411 /deep/0/README.md----pretty----pretty------workspaces-annadale-pretty-.png )
135
138
136
139
` write-exception ` navigates down the exception hierarchy; it only presents the stack trace for the deepest, or root, exception. It can navigate
137
140
any property that returns a non-nil Throwable type, not just the rootCause property; this makes it properly expand older exceptions
@@ -144,3 +147,11 @@ or Java class and method, and the right columns presenting the file name and lin
144
147
145
148
The related function, ` format-exception ` , produces the same output, but returns it as a string.
146
149
150
+ # io.aviso.columns
151
+
152
+ The columnar namespace is what's used by the exceptions namespace to format the exceptions, properties, and stack
153
+ traces.
154
+
155
+ The ` format-columns ` function is provided with a number of column definitions that describes the width and justification
156
+
157
+
0 commit comments