summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-07-20 06:54:22 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-07-20 05:32:28 -0700
commit5313297fe84c596f9222a4890dd45a53a6d4d632 (patch)
treeceacf73477e129786a8566fff146c18cd57c0edf /setup.py
parentde38a0e74a8683a3d3381038aeee4d226cc5b714 (diff)
downloadpython-coveragepy-git-5313297fe84c596f9222a4890dd45a53a6d4d632.tar.gz
fix: raise chained errors with "from" #998
This makes exceptions report their causes correctly, as "The above exception was the direct cause of the following exception" instead of "During handling of the above exception, another exception occurred."
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/setup.py b/setup.py
index f6fb7b4e..1c540764 100644
--- a/setup.py
+++ b/setup.py
@@ -161,8 +161,8 @@ class ve_build_ext(build_ext):
"""Wrap `run` with `BuildFailed`."""
try:
build_ext.run(self)
- except errors.DistutilsPlatformError:
- raise BuildFailed()
+ except errors.DistutilsPlatformError as exc:
+ raise BuildFailed() from exc
def build_extension(self, ext):
"""Wrap `build_extension` with `BuildFailed`."""
@@ -170,12 +170,12 @@ class ve_build_ext(build_ext):
# Uncomment to test compile failure handling:
# raise errors.CCompilerError("OOPS")
build_ext.build_extension(self, ext)
- except ext_errors:
- raise BuildFailed()
+ except ext_errors as exc:
+ raise BuildFailed() from exc
except ValueError as err:
# this can happen on Windows 64 bit, see Python issue 7511
if "'path'" in str(err): # works with both py 2/3
- raise BuildFailed()
+ raise BuildFailed() from err
raise
# There are a few reasons we might not be able to compile the C extension.