Skip to content

Commit f4f0e1b

Browse files
authored
Better error message (#30)
1 parent 75432bd commit f4f0e1b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sphinx_runpython/docassert/sphinx_docassert_extension.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,13 @@ def param_names(self):
4949

5050

5151
def parse_signature(text: str) -> Signature:
52+
if text is None:
53+
return None
5254
reg = re.compile("([_a-zA-Z][_a-zA-Z0-9]*?)[(](.*?)[)]( -> ([a-zA-Z0-9]+))?")
53-
res = reg.search(text)
55+
try:
56+
res = reg.search(text)
57+
except TypeError as e:
58+
raise TypeError(f"Unexpected type {type(text)} for text.") from e
5459
if res is None:
5560
return None
5661
name, params, _, result = res.groups()

0 commit comments

Comments
 (0)