Skip to main content

Module hook

Module hook 

Source
Expand description

Hook installation helpers.

miette stores its error hook in a process-global OnceLock, which means miette::set_hook succeeds only on the first call and refuses subsequent attempts with InstallError. To give callers mutable, idempotent semantics โ€” swap the footer at any time, call install_* twice without panicking โ€” we install a single wrapper handler that reads from our own, mutable footer slot at render time.

The net effect for callers: all three install_* functions are safe to call in any order, any number of times.

Functionsยง

install_panic_hook
Install the miette panic hook, routing panics through the same graphical report pipeline.
install_report_handler
Install the default miette graphical report handler.
install_with_footer
Install the report handler (if not already) and register a closure that appends a tool-specific support footer to every rendered diagnostic.