raise ImportError when exec_module

This commit is contained in:
yanyongyu 2021-04-21 18:26:58 +08:00
parent 5abc0d9614
commit 9052214e6d

View File

@ -221,7 +221,11 @@ class PluginLoader(SourceFileLoader):
if self._export_token:
setattr(module, "__export__", _export.get())
try:
super().exec_module(module)
except Exception as e:
raise ImportError(
f"Error when executing module {self.name}.") from e
if self._plugin_token:
_current_plugin.reset(self._plugin_token)