Visitar URL original
Better error message (#15) · sdpython/sphinx-runpython@b061881 · GitHub
Skip to content

Commit b061881

Browse files
authored
Better error message (#15)
1 parent 7a84c60 commit b061881

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ build/*
1010
.eggs/*
1111
*egg-info/*
1212
temp_*
13+
_doc/CHANGELOGS*
14+
_doc/LICENSE
1315
_doc/api/oo.png
1416
_doc/examples/_cache/*
1517
_doc/auto_examples/*

‎sphinx_runpython/github_link.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ def _linkcode_resolve(domain, info, package, url_fmt, revision):
3333
return
3434

3535
class_name = info["fullname"].split(".")[0]
36-
module = __import__(info["module"], fromlist=[class_name])
36+
try:
37+
module = __import__(info["module"], fromlist=[class_name])
38+
except ImportError as e:
39+
raise ImportError(
40+
f"Unable to find {info['module']!r} wich class={class_name!r}."
41+
) from e
3742
obj = attrgetter(info["fullname"])(module)
3843

3944
# Unwrap the object to get the correct source

0 commit comments

Comments
 (0)