Exception Chaining
Preserving exception context
Interview Relevant: Advanced error handling
Exception Chaining
Wrap exceptions while preserving cause.
Code Examples
python
1try:
2 db.connect()
3except ConnectionError as e:
4 raise RuntimeError("Database failed") from e