Improve the message for errors in package recipes (#37589)

fixes #30355
This commit is contained in:
Massimiliano Culpo 2023-05-11 10:34:39 +02:00 committed by GitHub
parent 297329f4b5
commit 8da29d1231
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1240,6 +1240,9 @@ def get_pkg_class(self, pkg_name):
module = importlib.import_module(fullname)
except ImportError:
raise UnknownPackageError(pkg_name)
except Exception as e:
msg = f"cannot load package '{pkg_name}' from the '{self.namespace}' repository: {e}"
raise RepoError(msg) from e
cls = getattr(module, class_name)
if not inspect.isclass(cls):