.. _bad-exception-cause:

bad-exception-cause / E0705
===========================

**Message emitted:**

``Exception cause set to something which is not an exception, nor None``

**Description:**

*Used when using the syntax "raise ... from ...", where the exception cause is not an exception, nor None.*

**Problematic code:**

.. literalinclude:: /data/messages/b/bad-exception-cause/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/b/bad-exception-cause/good.py
   :language: python



**Related links:**

- `The raise statement <https://docs.python.org/3/reference/simple_stmts.html#the-raise-statement>`_
- `Explicit Exception Chaining <https://peps.python.org/pep-3134/#explicit-exception-chaining>`_ per PEP 3134


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