Cause and stacktrace analysis for exceptions
Cause and stacktrace analysis for exceptions
(analyze-cause e print-fn)
Return a map describing the exception cause. If ex-data
exists, a :data
key is appended.
Return a map describing the exception cause. If `ex-data` exists, a `:data` key is appended.
(analyze-causes e print-fn)
Return the cause chain beginning with the thrown exception, with stack frames
for each. For ex-info
exceptions response contains :data slot with pretty
printed data. For clojure.spec asserts, :spec slot contains a map of pretty
printed components describing spec failures.
Return the cause chain beginning with the thrown exception, with stack frames for each. For `ex-info` exceptions response contains :data slot with pretty printed data. For clojure.spec asserts, :spec slot contains a map of pretty printed components describing spec failures.
(analyze-file {:keys [file] :as frame})
Associate the file type (extension) of the source file to the frame map, and
add it as a flag. If the name is NO_SOURCE_FILE
, type clj
is assumed.
Associate the file type (extension) of the source file to the frame map, and add it as a flag. If the name is `NO_SOURCE_FILE`, type `clj` is assumed.
(analyze-fn {:keys [type class method] :as frame})
Add namespace, fn, and var to the frame map when the source is a Clojure function.
Add namespace, fn, and var to the frame map when the source is a Clojure function.
(analyze-frame namespaces frame)
Return the stacktrace as a sequence of maps, each describing a stack frame.
Return the stacktrace as a sequence of maps, each describing a stack frame.
(analyze-stacktrace e)
Return the stacktrace as a sequence of maps, each describing a stack frame.
Return the stacktrace as a sequence of maps, each describing a stack frame.
(directory-namespaces)
Looks for all namespaces inside of directories on the class path, ignoring jars.
It's a defn because this set is always subject to change.
NOTE: depending on the use case, you might want to filter out
namespaces such as user
which while belong to the project,
don't share a common naming scheme with the other namespaces.
Looks for all namespaces inside of directories on the class path, ignoring jars. It's a defn because this set is always subject to change. NOTE: depending on the use case, you might want to filter out namespaces such as `user` which while belong to the project, don't share a common naming scheme with the other namespaces.
(extract-location {:keys [class message location] :as cause})
If the cause is a compiler exception, extract the useful location information
from its message or from :location
if provided.
Include relative path for simpler reporting.
If the cause is a compiler exception, extract the useful location information from its message or from `:location` if provided. Include relative path for simpler reporting.
(filtered-ex-data e)
Same as ex-data
, but filters out entries whose keys are
blacklisted (generally for containing data not intended for reading by a
human).
Same as `ex-data`, but filters out entries whose keys are blacklisted (generally for containing data not intended for reading by a human).
(flag-duplicates frames)
Where a parent and child frame represent substantially the same source location, flag the parent as a duplicate.
Where a parent and child frame represent substantially the same source location, flag the parent as a duplicate.
(flag-frame frame flag)
Update frame's flags vector to include the new flag.
Update frame's flags vector to include the new flag.
(flag-project namespaces {:keys [ns] :as frame})
Flag the frame if it is from the users project. From a users project means that the namespace is one we have identified or it begins with the identified common prefix.
Flag the frame if it is from the users project. From a users project means that the namespace is one we have identified or it begins with the identified common prefix.
(flag-repl {:keys [file] :as frame})
Flag the frame if its source is a REPL eval.
Flag the frame if its source is a REPL eval.
(flag-tooling frames)
Walk the call stack from top to bottom, flagging frames below the first call
to clojure.lang.Compiler
or nrepl.*
as :tooling
to
distinguish compilation and nREPL middleware frames from user code.
Walk the call stack from top to bottom, flagging frames below the first call to `clojure.lang.Compiler` or `nrepl.*` as `:tooling` to distinguish compilation and nREPL middleware frames from user code.
(handle-stacktrace _
{:keys [session transport :nrepl.middleware.print/print-fn]
:as msg})
In order to match more namespaces, we look for a common namespace prefix across the ones we have identified.
In order to match more namespaces, we look for a common namespace prefix across the ones we have identified.
(prepare-spec-data ed pprint-str)
Prepare spec problems for display in user stacktraces.
Take in a map ed
as returned by clojure.spec/explain-data
and return a map
of pretty printed problems. The content of the returned map is modeled after
clojure.spec/explain-printer
.
Prepare spec problems for display in user stacktraces. Take in a map `ed` as returned by `clojure.spec/explain-data` and return a map of pretty printed problems. The content of the returned map is modeled after `clojure.spec/explain-printer`.
(relative-path path)
If the path is under the project root, return the relative path; otherwise return the original path.
If the path is under the project root, return the relative path; otherwise return the original path.
(stack-frame frame)
Return a map describing the stack frame.
Return a map describing the stack frame.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close