Here is a little patch I suggest for autodoc.

In :file:`sphinx/ext/autodoc.py` line 332
(meth:`Documenter.import.object`), add 2 lines::

        except Exception, err:
            if self.env.app.warningiserror:  # ADDED
                raise                        # ADDED
            self.directive.warn(
                'autodoc can\'t import/find %s %r, it reported error: '
                '"%s", please check your spelling and sys.path' %
                (self.objtype, str(self.fullname), err))
            return False

This is about when a module you are autodocumenting fails to import.
Sphinx's or autodoc's usual behaviour is to just issue a one-line
warning. That's perfect. When sphinx-build was called with `-W` then the
warning causes it to stop. That's also perfect. I just would like it to
stop with a traceback and not with a single warning line.

For me this change is important because otherwise there is no way to see
a traceback of what happened.

One drawback is that it says also the usual "Please also report this if
it was a user error, so that a better error message can be provided next
time..." which, in such a case, is not appropriate since the error has
nothing to do with Sphinx.

Luc

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-...@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to