|
227 | 227 |
|
228 | 228 | The *fonts* var contains ANSI definitions for how fonts are displayed; bind it to nil to remove ANSI formatting entirely."
|
229 | 229 | ([exception] (write-exception *out* exception))
|
230 |
| - ([writer exception & {:keys [frame-limit]}] |
| 230 | + ([writer exception & {show-properties? :properties |
| 231 | + frame-limit :frame-limit |
| 232 | + :or {show-properties? true}}] |
231 | 233 | (let [exception-font (:exception *fonts*)
|
232 | 234 | message-font (:message *fonts*)
|
233 | 235 | property-font (:property *fonts*)
|
|
241 | 243 | (doseq [e exception-stack]
|
242 | 244 | (let [^Throwable exception (-> e :exception)
|
243 | 245 | class-name (:name e)
|
244 |
| - message (.getMessage exception) |
245 |
| - properties (update-keys (:properties e) name) |
246 |
| - prop-keys (keys properties) |
247 |
| - ;; Allow for the width of the exception class name, and some extra |
248 |
| - ;; indentation. |
249 |
| - property-formatter (c/format-columns " " |
250 |
| - [:right (c/max-length prop-keys)] |
251 |
| - ": " |
252 |
| - :none)] |
| 246 | + message (.getMessage exception)] |
253 | 247 | (exception-formatter writer
|
254 | 248 | (str exception-font class-name reset-font)
|
255 | 249 | (str message-font message reset-font))
|
256 |
| - (doseq [k (sort prop-keys)] |
257 |
| - (property-formatter writer |
258 |
| - (str property-font k reset-font) |
259 |
| - (-> properties (get k) format-property-value))) |
| 250 | + (when show-properties? |
| 251 | + (let [properties (update-keys (:properties e) name) |
| 252 | + prop-keys (keys properties) |
| 253 | + ;; Allow for the width of the exception class name, and some extra |
| 254 | + ;; indentation. |
| 255 | + property-formatter (c/format-columns " " |
| 256 | + [:right (c/max-length prop-keys)] |
| 257 | + ": " |
| 258 | + :none)] |
| 259 | + (doseq [k (sort prop-keys)] |
| 260 | + (property-formatter writer |
| 261 | + (str property-font k reset-font) |
| 262 | + (-> properties (get k) format-property-value))))) |
260 | 263 | (if (:root e)
|
261 | 264 | (write-stack-trace writer exception frame-limit)))))))
|
262 | 265 |
|
|
0 commit comments