diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-07-20 06:54:22 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-07-20 05:32:28 -0700 |
commit | 5313297fe84c596f9222a4890dd45a53a6d4d632 (patch) | |
tree | ceacf73477e129786a8566fff146c18cd57c0edf /coverage/sqldata.py | |
parent | de38a0e74a8683a3d3381038aeee4d226cc5b714 (diff) | |
download | python-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 'coverage/sqldata.py')
-rw-r--r-- | coverage/sqldata.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/coverage/sqldata.py b/coverage/sqldata.py index 41542969..b2133026 100644 --- a/coverage/sqldata.py +++ b/coverage/sqldata.py @@ -291,7 +291,7 @@ class CoverageData(SimpleReprMixin): "Data file {!r} doesn't seem to be a coverage data file: {}".format( self._filename, exc ) - ) + ) from exc else: if schema_version != SCHEMA_VERSION: raise CoverageException( @@ -1095,7 +1095,7 @@ class SqliteDb(SimpleReprMixin): pass if self.debug: self.debug.write(f"EXCEPTION from execute: {msg}") - raise CoverageException(f"Couldn't use data file {self.filename!r}: {msg}") + raise CoverageException(f"Couldn't use data file {self.filename!r}: {msg}") from exc def execute_one(self, sql, parameters=()): """Execute a statement and return the one row that results. |