Exception Chaining
Use raise ... from ... to chain exceptions, preserving the original cause for debugging.
Use raise ... from ... to chain exceptions, preserving the original cause for debugging.
try:
int("abc")
except ValueError as e:
raise RuntimeError("Conversion failed") from e
Exception chaining preserves the full traceback context.