(node)
return any(is_exception(parent) for parent in node.ancestors(recurs=True))
Check if a class is an exception.

    :param node: The node to check.
    :type node: astroid.nodes.ClassDef

    :returns: True if the class is an exception, False otherwise.
    :rtype: bool
Check if a class is an exception.
Check if a class is an exception .
def is_exception(node):
    """Check if a class is an exception.

    :param node: The node to check.
    :type node: astroid.nodes.ClassDef

    :returns: True if the class is an exception, False otherwise.
    :rtype: bool
    """
    if node.name in ("Exception", "BaseException") and node.root().name == "builtins":
        return True

    if not hasattr(node, "ancestors"):
        return False

    return any(is_exception(parent) for parent in node.ancestors(recurs=True))
def is_exception ( node ) : if node . name in ( "Exception" , "BaseException" ) and node . root ( ) . name == "builtins" : return True if not hasattr ( node , "ancestors" ) : return False return any ( is_exception ( parent ) for parent in node . ancestors ( recurs = True ) )