summaryrefslogtreecommitdiff
path: root/pylint/checkers/imports.py
diff options
context:
space:
mode:
authorJacob Walls <jacobtylerwalls@gmail.com>2022-05-30 15:13:30 -0400
committerJacob Walls <jacobtylerwalls@gmail.com>2022-05-30 16:38:24 -0400
commitd3180eafff77fc6eb56d0418e997cd6e0f31ede8 (patch)
tree99322da211c225449b38c02c907c37eda2fb4790 /pylint/checkers/imports.py
parent896c8ed26bea4e3ecf92f991e2274b93dc2dc74b (diff)
downloadpylint-git-d3180eafff77fc6eb56d0418e997cd6e0f31ede8.tar.gz
Reraise failures in astroid as `AstroidError`
Diffstat (limited to 'pylint/checkers/imports.py')
-rw-r--r--pylint/checkers/imports.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/pylint/checkers/imports.py b/pylint/checkers/imports.py
index afeb25fbf..0119c9bcf 100644
--- a/pylint/checkers/imports.py
+++ b/pylint/checkers/imports.py
@@ -771,7 +771,7 @@ class ImportsChecker(DeprecatedMixin, BaseChecker):
message = f"Cannot import {modname!r} due to syntax error {str(exc.error)!r}" # pylint: disable=no-member; false positive
self.add_message("syntax-error", line=importnode.lineno, args=message)
- except astroid.AstroidBuildingException:
+ except astroid.AstroidBuildingError:
if not self.linter.is_message_enabled("import-error"):
return None
if _ignore_import_failure(importnode, modname, self._ignored_modules):
@@ -784,6 +784,8 @@ class ImportsChecker(DeprecatedMixin, BaseChecker):
dotted_modname = get_import_name(importnode, modname)
self.add_message("import-error", args=repr(dotted_modname), node=importnode)
+ except Exception as e: # pragma: no cover
+ raise astroid.AstroidError from e
return None
def _add_imported_module(