Skip to content

Commit d2b9d40

Browse files
committed
report object name upon mangle_docstrings exception
1 parent 9cd5944 commit d2b9d40

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

numpydoc/numpydoc.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import inspect
2525
import collections
2626
import hashlib
27+
import logging
2728

2829
from docutils.nodes import citation, Text
2930
import sphinx
@@ -35,6 +36,8 @@
3536
from .docscrape_sphinx import get_doc_object, SphinxDocString
3637
from . import __version__
3738

39+
logger = logging.getLogger(__name__)
40+
3841
if sys.version_info[0] >= 3:
3942
sixu = lambda s: s
4043
else:
@@ -124,13 +127,17 @@ def mangle_docstrings(app, what, name, obj, options, lines):
124127
title_re = re.compile(sixu(pattern), re.I | re.S)
125128
lines[:] = title_re.sub(sixu(''), u_NL.join(lines)).split(u_NL)
126129
else:
127-
doc = get_doc_object(obj, what, u_NL.join(lines), config=cfg,
128-
builder=app.builder)
129-
if sys.version_info[0] >= 3:
130-
doc = str(doc)
131-
else:
132-
doc = unicode(doc)
133-
lines[:] = doc.split(u_NL)
130+
try:
131+
doc = get_doc_object(obj, what, u_NL.join(lines), config=cfg,
132+
builder=app.builder)
133+
if sys.version_info[0] >= 3:
134+
doc = str(doc)
135+
else:
136+
doc = unicode(doc)
137+
lines[:] = doc.split(u_NL)
138+
except:
139+
logger.error('While processing numpydoc for %r', name)
140+
raise
134141

135142
if (app.config.numpydoc_edit_link and hasattr(obj, '__name__') and
136143
obj.__name__):

0 commit comments

Comments
 (0)