2
0
mirror of https://github.com/Nick80835/microbot synced 2025-08-31 06:26:04 +00:00

catch errors when loading modules upon startup

This commit is contained in:
Nick80835
2020-06-24 14:21:58 -04:00
parent 5a42bb4c0c
commit 5f3c2f6ee5

View File

@@ -30,7 +30,10 @@ class Loader():
self._find_all_modules()
for module_name in self.all_modules:
self.loaded_modules.append(import_module("ubot.modules." + module_name))
try:
self.loaded_modules.append(import_module("ubot.modules." + module_name))
except Exception as exception:
self.logger.error(f"Error while loading {module_name}: {exception}")
def reload_all_modules(self):
self.command_handler.incoming_commands = []