Merge pull request #7603 from eric-wieser/warning-as-error-traceback

Preserve exception info in raised SphinxWarning objects
This commit is contained in:
Takeshi KOMIYA 2020-05-03 23:52:55 +09:00 committed by GitHub
commit f93e5a59b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -412,9 +412,13 @@ class WarningIsErrorFilter(logging.Filter):
message = record.msg # use record.msg itself
if location:
raise SphinxWarning(location + ":" + str(message))
exc = SphinxWarning(location + ":" + str(message))
else:
raise SphinxWarning(message)
exc = SphinxWarning(message)
if record.exc_info is not None:
raise exc from record.exc_info[1]
else:
raise exc
else:
return True