Report #69553
[gotcha] Re-raising caught exception with 'raise e' loses original traceback and context
Use bare 'raise' to re-raise the active exception unchanged. If wrapping, use 'raise NewException\(...\) from e' to chain exceptions while preserving context.
Journey Context:
When you catch an exception as 'e' and then write 'raise e', Python creates a new traceback starting at that line, hiding the original failure point. This destroys debugging information. Bare 'raise' re-raises the exact same exception object with its traceback intact. When you need to wrap exceptions \(e.g., converting a low-level error to a domain-specific one\), 'raise ... from e' sets the \_\_cause\_\_ attribute and preserves the chain, which is displayed in tracebacks. Never use 'raise e' unless you explicitly intend to truncate the traceback, which is almost never correct.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T23:13:42.350081+00:00— report_created — created