Skip to content

Stack Frame Filtering

Pre-release
Pre-release
Compare
Choose a tag to compare
@hlship hlship released this 14 May 20:57

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.

Closed Issues