liveBook · Manning

Pst

As explained in Clojure: The Essential Reference

pst is a Clojure REPL function that prints a selected portion of an exception's stack trace, including nested causes when present.

pst is a Clojure REPL utility for printing a readable portion of an exception's stack trace. Called without an argument, it reports the most recent REPL exception; given an exception, it prints that exception instead. section 22.3

Inspect the root cause

After wrapping a divide-by-zero error in nested ex-info exceptions, (pst ex 3) prints the outer exception, each “Caused by” exception, and three frames per level. To focus only on the underlying failure, use (pst (root-cause ex) 3), which prints the ArithmeticException trace.

How Clojure: The Essential Reference covers it

How deep it goes
Demonstrates default and bounded output, nested causes, and root-cause inspection without detailing implementation internals.
Examples
Uses divide-by-zero, ex-info, bounded traces, nested causes, and root-cause extraction as concrete debugging examples.
What it assumes
Uses a Clojure REPL and exception values, while demonstrating both implicit latest-exception and explicit-exception forms.
What you can do after
Diagnose/debug with it by locating relevant stack frames and separating a wrapped exception from its underlying cause.
How it connects
Connects exceptions and stack traces with nested causes, root-cause, and REPL debugging.

This explainer was generated by Manning's knowledge graph from the text of Clojure: The Essential Reference. The section links point to the parts of the book it draws on.