Merge pull request #97 from ant9000/pr/load_plugin_error_handling

Trap and log errors when loading plugins
This commit is contained in:
markqvist 2026-04-13 01:51:13 +02:00 committed by GitHub
commit 51c58efb75
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -849,7 +849,11 @@ class SidebandCore():
plugin_globals["SidebandTelemetryPlugin"] = SidebandTelemetryPlugin
RNS.log("Loading plugin \""+str(file)+"\"", RNS.LOG_NOTICE)
plugin_path = os.path.join(plugins_path, file)
exec(open(plugin_path).read(), plugin_globals)
try:
exec(open(plugin_path).read(), plugin_globals)
except Exception as e:
RNS.log("Error loading plugin \""+str(file)+"\": "+str(e), RNS.LOG_ERROR)
continue
plugin_class = plugin_globals["plugin_class"]
if plugin_class != None: