pylint-errors

E0702 (raising-bad-type)

:x: Problematic code:

def foo(x, y):
    try:
        return x / y
    except ZeroDivisionError:
        raise None

:heavy_check_mark: Correct code:

def foo(x, y):
    try:
        return int(x / y)
    except ZeroDivisionError as e:
        raise ValueError from e

Rationale:

Used when something which is neither a class, an instance or a string is raised (i.e. a TypeError will be raised).