Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document/implement plugin failure capability #3220

Closed
Xeverous opened this issue Feb 6, 2019 · 2 comments
Closed

document/implement plugin failure capability #3220

Xeverous opened this issue Feb 6, 2019 · 2 comments

Comments

@Xeverous
Copy link

Xeverous commented Feb 6, 2019

I would like to implement a shortcode plugin, like described in https://www.getnikola.com/extending.html#shortcodes

I'm making a site that requires custom build steps (mostly custom markdown/HTML embeds), so a significant part of the build would be directed into plugins. The job is complex enough that I would like to force entire site build to fail if one of my plugins detects an error in the data.

Is there any standard/recommended way to do this? Currently I don't see any other opportunity than raising an exception in the plugin implementation. However, such thing is undocumented and I would rather not rely on implementation details.

@Kwpolska
Copy link
Member

Kwpolska commented Feb 6, 2019

Raising an exception is the standard mechanism for reporting failures in Python. Since there is no other special mechanism exposed to Nikola plugins, you should assume exceptions are the way to report failures. Examples of raising exceptions inside plugins can be found in the codebase.

I don’t think that this behavior needs any special documentation.

@Xeverous
Copy link
Author

Xeverous commented Feb 6, 2019

Ok, thanks for confirmation.

@Xeverous Xeverous closed this as completed Feb 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants