.. _lost-exception:

lost-exception / W0150
======================

**Message emitted:**

%s statement in finally block may swallow exception

**Description:**

*Used when a break or a return statement is found inside the finally clause of a try...finally block: the exceptions raised in the try clause will be silently swallowed instead of being re-raised.*

**Problematic code:**

.. literalinclude:: /data/messages/l/lost-exception/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/l/lost-exception/good.py
   :language: python



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