Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2020-05-03 16:58:19 +0300
committerEric Wieser <wieser.eric@gmail.com>2020-05-03 16:58:19 +0300
commit5ed31be51fe3f00642527bc9781cab3d52e97641 (patch)
treea5684f155a7bae5e1f8161b73065de3fa79f3db3 /sphinx/util/logging.py
parentb82687ecc167567728961feb68326cb4b4c71a44 (diff)
Preserve exception info in raised SphinxWarning objects
Diffstat (limited to 'sphinx/util/logging.py')
-rw-r--r--sphinx/util/logging.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/sphinx/util/logging.py b/sphinx/util/logging.py
index 53053faaf..5889f3860 100644
--- a/sphinx/util/logging.py
+++ b/sphinx/util/logging.py
@@ -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