void (@NotNull PyRaiseStatement node) { PyExpression[] expressions = node.getExpressions(); if (expressions.length == 0) { return; } PyExpression expression = expressions[0]; if (expression instanceof PyCallExpression) { PyExpression callee = ((PyCallExpression)expression).getCallee(); if (callee instanceof PyReferenceExpression) { final PsiPolyVariantReference reference = ((PyReferenceExpression)callee).getReference(getResolveContext()); PsiElement psiElement = reference.resolve(); if (psiElement instanceof PyClass aClass) { for (PyClassLikeType type : aClass.getAncestorTypes(myTypeEvalContext)) { if (type == null) { return; } final String name = type.getName(); if (name == null || "BaseException".equals(name) || "Exception".equals(name)) { return; } } registerProblem(expression, PyPsiBundle.message("INSP.exception.inheritance.exception.does.not.inherit.from.base.exception.class"), new PyAddExceptionSuperClassQuickFix()); } } } }