bad-except-order / E0701#

Message emitted:

Bad except clauses order (%s)

Description:

Used when except clauses are not in the correct order (from the more specific to the more generic). If you don't fix the order, some exceptions may not be caught by the most specific handler.

Correct code:

try:
    print(int(input()))
except TypeError:
    raise
except Exception:
    raise

Problematic code:

try:
    print(int(input()))
except Exception:
    raise
except TypeError:  # [bad-except-order]
    # This block cannot be reached since TypeError exception
    # is caught by previous exception handler.
    raise

Created by the exceptions checker.