-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
ExtensionError shows no information about what extension caused it #8813
Comments
Good point! |
…nt handler Show the module name of the event handler on the error inside it to let users know a hint of the error.
…nt handler Show the module name of the event handler on the error inside it to let users know a hint of the error.
…nt handler Show the module name of the event handler on the error inside it to let users know a hint of the error.
Close #8813: Show what extension caused it on errors on event handler
Thanks for #8822, which fixes my example situation! However, I was hoping for a more general solution ... let me try to come up with another, more realistic example:
import sphinx
def helper_function():
raise NotImplementedError('This is a dummy function!')
def _env_updated(app, env):
try:
helper_function()
except Exception as e:
raise sphinx.errors.ExtensionError('An error happened', e) from e
def setup(app):
app.connect('env-updated', _env_updated)
extensions = [
'my_extension',
] This produces the following error message:
... while I think it would be more helpful to get something like this:
|
Oops... is there any extension using |
Yes, I'm using Is there another, better way to achieve this? Raising any other exception created a traceback when I last tried. |
I think we've not provided an official way to do that. I agree |
I've had a quick look at the Sphinx history and I found that there was a change (which I wasn't aware of) with release 3.0.1, more specifically in #7658. This is great, because now any exception (except if derived from This means, starting with Sphinx 3.0.1 it is not necessary anymore for extension authors to explicitly use
Since the change I mentioned above, there is no reason to recommend using I have only used The question is now: what should extensions do that already use I'm not using this in my own extensions anymore (I'm currently removing the last instance in mgeier/sphinx-last-updated-by-git#25), but I've found one instance there: I guess the easiest solution would be to simply wait until the extension doesn't support But if Sphinx can somehow handle these cases automatically, this would be great. |
I don't know what are you asking. AFAIK, there are no recommendation to use |
Yes |
I think there is nothing to do for this topic. So I'm closing this now. |
Currently, when an
ExtensionError
happens during build, the textExtension error:
followed by the actual error message is shown.This is helpful if the error message from the extension is clear about what to do to fix the problem.
However, if there are many extensions and the error message isn't quite as clear, a user might have no idea where this message even came from.
Of course, extension authors could try to include their extension name in each of the possible error messages, but I don't think this will happen in many cases and even if the extension name is added in some cases, it's easy to miss it in some other cases.
Would it be possible/feasible for Sphinx to check which extension caused which
ExtensionError
and include the extension name in the error message?Describe the bug
An
ExtensionError
doesn't show which extension caused it.To Reproduce
conf.py
:This produces the following error message:
Expected behavior
This doesn't make the error message itself better, but at least I know I should start looking at the
intersphinx
extension and its settings ...The text was updated successfully, but these errors were encountered: