Skip to content

Commit 1953ef6

Browse files
jnothmanrgommers
authored andcommitted
report object name upon mangle_docstrings exception
1 parent af6690a commit 1953ef6

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
@@ -28,6 +28,7 @@
2828
from collections import Callable
2929
import hashlib
3030
import itertools
31+
import logging
3132

3233
from docutils.nodes import citation, Text, section, comment, reference
3334
import sphinx
@@ -39,6 +40,8 @@
3940
from .docscrape_sphinx import get_doc_object
4041
from . import __version__
4142

43+
logger = logging.getLogger(__name__)
44+
4245
if sys.version_info[0] >= 3:
4346
sixu = lambda s: s
4447
else:
@@ -162,13 +165,17 @@ def mangle_docstrings(app, what, name, obj, options, lines):
162165
title_re = re.compile(sixu(pattern), re.I | re.S)
163166
lines[:] = title_re.sub(sixu(''), u_NL.join(lines)).split(u_NL)
164167
else:
165-
doc = get_doc_object(obj, what, u_NL.join(lines), config=cfg,
166-
builder=app.builder)
167-
if sys.version_info[0] >= 3:
168-
doc = str(doc)
169-
else:
170-
doc = unicode(doc)
171-
lines[:] = doc.split(u_NL)
168+
try:
169+
doc = get_doc_object(obj, what, u_NL.join(lines), config=cfg,
170+
builder=app.builder)
171+
if sys.version_info[0] >= 3:
172+
doc = str(doc)
173+
else:
174+
doc = unicode(doc)
175+
lines[:] = doc.split(u_NL)
176+
except:
177+
logger.error('While processing numpydoc for %r', name)
178+
raise
172179

173180
if (app.config.numpydoc_edit_link and hasattr(obj, '__name__') and
174181
obj.__name__):

0 commit comments

Comments
 (0)