mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #4653 from adam-azarchs/patch-1
Fix error reporting for parameterless ImportErrors
This commit is contained in:
commit
b192bbfb15
@ -179,7 +179,7 @@ def import_object(modname, objpath, objtype='', attrgetter=safe_getattr, warning
|
||||
if isinstance(real_exc, SystemExit):
|
||||
errmsg += ('; the module executes module level statement '
|
||||
'and it might call sys.exit().')
|
||||
elif isinstance(real_exc, ImportError):
|
||||
elif isinstance(real_exc, ImportError) and real_exc.args:
|
||||
errmsg += '; the following exception was raised:\n%s' % real_exc.args[0]
|
||||
else:
|
||||
errmsg += '; the following exception was raised:\n%s' % traceback_msg
|
||||
|
Loading…
Reference in New Issue
Block a user