.. _raise-missing-from:

raise-missing-from / W0707
==========================

**Message emitted:**

Consider explicitly re-raising using %s'%s from %s'

**Description:**

*Python's exception chaining shows the traceback of the current exception, but also of the original exception. When you raise a new exception after another exception was caught it's likely that the second exception is a friendly re-wrapping of the first exception. In such cases `raise from` provides a better link between the two tracebacks in the final error.*

**Problematic code:**

.. literalinclude:: /data/messages/r/raise-missing-from/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/r/raise-missing-from/good.py
   :language: python


**Related links:**

- `PEP 3134 <https://peps.python.org/pep-3134/>`_

Created by the `exceptions <https://github.com/PyCQA/pylint/blob/main/pylint/checkers/exceptions.py>`__ checker.