On failing to load a plugin, show the stacktrace is pelican is run in debug mode

This commit is contained in:
MinchinWeb 2024-01-27 10:51:35 -07:00
commit 1f14606f83

View file

@ -80,8 +80,14 @@ class Pelican:
plugin.register()
self.plugins.append(plugin)
except Exception as e:
logger.error("Cannot register plugin `%s`\n%s", name, e, stacklevel=3)
print(e.stacktrace)
logger.error(
"Cannot register plugin `%s`\n%s",
name,
e,
stacklevel=2,
)
if self.settings.get("DEBUG", False):
console.print_exception()
self.settings["PLUGINS"] = [get_plugin_name(p) for p in self.plugins]