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

BUG: Allow extensions to pass Sphinx errors during init #7699

Closed
wants to merge 1 commit into from

Conversation

larsoner
Copy link
Contributor

In sphinx-gallery #7683 causes some problems for us because we used to check that things like ValueError were raised during builder init, but now it's always ExtensionError with the message "Handler <function generate_gallery_rst at 0x7f88327f69d0> for event 'builder-inited' threw an exception", and the useful error message higher up.

One solution is that we can switch to emitting ExtensionError and ConfigError as appropriate (I have tested this and it works). Then Sphinx needs the change here, and things work as expected.

Let me know if there is some other solution. It's possible that there are other events that get emitted that might need similar changes.

@larsoner
Copy link
Contributor Author

... another option would be to add a new config value allowed_exceptions where you specify which exceptions to pass through, and then each self.emit or self.events.emit would use allowed_exceptions=self.allowed_exceptions or so. But again I'm not sure if this makes much sense.

@eric-wieser
Copy link
Contributor

Is #7658 related in any way here?

@tk0miya
Copy link
Member

tk0miya commented May 21, 2020

Sorry for bothering you. I don't know your extension raises a ValueError on the handler.

BTW, I think current implementation accept SphinxError without allowed_exceptions. So it would go well with replacing ValueError with SphinxError family now.

@larsoner
Copy link
Contributor Author

Indeed it does! Sorry for the noise

@larsoner larsoner closed this May 21, 2020
@larsoner larsoner deleted the allow branch May 21, 2020 13:59
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants