errors
Turn an exception into something safe to send to Datadog.
Datadog is a third-party processor with retention this code cannot revoke per
record, so an exception message never leaves the machine: a message can
carry patient data in prose (no matching record for <name>), which has no
shape to detect and no safe way to scrub. Frames can go, because
traceback.format_tb emits code locations and source lines - static program
text - and never the value of a local.
Same policy as bitfount.patient_api.app, which has shipped frames without
messages since it was written; this module is that policy applied handler-wide.
Module
Functions
format_stacktrace_frames
def format_stacktrace_frames(exc: BaseException | None) ‑> str | None:Format exc's frames, following its cause chain, without any message.
Only traceback.format_tb is used. format_exc, format_exception and
format_exception_only all splice the exception message back in, and
format_exception walks __cause__/__context__ reproducing their
messages too - so the chain is walked here instead, taking frames alone.
Arguments
exc: The exception to format, orNone.
Returns
The frames as one string, or None if there are none to report.