Skip to content

Plugin registration fails, yet Pelican continues unperturbed, resulting in broken site. #3172

Open
@aknrdureegaesr

Description

@aknrdureegaesr
  • I have read the Filing Issues and subsequent “How to Get Help” sections of the documentation.
  • I have searched the issues (including closed ones) and believe that this is not a duplicate.
  • Debian GNU/Linux 11 (bullseye):
  • 3.9.2:
  • 4.8.0:
  • (my own):
  • (see below):
  • Link to your site:
  • Link to your source:
  • Link to a Gist with the contents of your settings file:

Issue

I'm running my own plugin that is needed to build my site. That plugin has some error handling at registration time.

Expectation: When the plugin cannot register, the site building stops and Pelican errors out.

Actually seen: When the plugin cannot register, an error is logged, but the site building continues. Pelican reports success to the operating system (exit value 0). But the generated site is broken, as the plugin never ran.

To reproduce, use a plugin like this one that errors out each time:

def register():
    raise RuntimeError("Something is wrong, cannot proceed with site building.")

I found this code in Pelican's __init__.py which I believe is pertinent:

    def init_plugins(self):
        self.plugins = []
        for plugin in load_plugins(self.settings):
            name = get_plugin_name(plugin)
            logger.debug('Registering plugin `%s`', name)
            try:
                plugin.register()
                self.plugins.append(plugin)
            except Exception as e:
                logger.error('Cannot register plugin `%s`\n%s',
                             name, e)

        self.settings['PLUGINS'] = [get_plugin_name(p) for p in self.plugins]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions