mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-28 05:27:30 +08:00
♿ raise ImportError when exec_module
This commit is contained in:
parent
5abc0d9614
commit
9052214e6d
@ -221,7 +221,11 @@ class PluginLoader(SourceFileLoader):
|
|||||||
if self._export_token:
|
if self._export_token:
|
||||||
setattr(module, "__export__", _export.get())
|
setattr(module, "__export__", _export.get())
|
||||||
|
|
||||||
|
try:
|
||||||
super().exec_module(module)
|
super().exec_module(module)
|
||||||
|
except Exception as e:
|
||||||
|
raise ImportError(
|
||||||
|
f"Error when executing module {self.name}.") from e
|
||||||
|
|
||||||
if self._plugin_token:
|
if self._plugin_token:
|
||||||
_current_plugin.reset(self._plugin_token)
|
_current_plugin.reset(self._plugin_token)
|
||||||
|
Loading…
Reference in New Issue
Block a user