summaryrefslogtreecommitdiff
path: root/coverage/data.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-11-13 19:23:24 -0500
committerNed Batchelder <ned@nedbatchelder.com>2021-11-14 08:12:49 -0500
commitb82e9fd8766a77c2a275bde7b574f3e8cb529f8f (patch)
treef310ea38a19f2b4e8c93ee3e3a5b8a99aa43351a /coverage/data.py
parent342e7da2941ae5291f1a94b6ad66ce489f6985fe (diff)
downloadpython-coveragepy-git-nedbat/exceptions.tar.gz
refactor: specialize exceptionsnedbat/exceptions
CoverageException is fine as a base class, but not good to use for raising (and catching sometimes). Introduce specialized exceptions that allow third-party tools to integrate better.
Diffstat (limited to 'coverage/data.py')
-rw-r--r--coverage/data.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/coverage/data.py b/coverage/data.py
index e7c94b4f..c70993ad 100644
--- a/coverage/data.py
+++ b/coverage/data.py
@@ -13,7 +13,7 @@ imports working.
import glob
import os.path
-from coverage.exceptions import CoverageException
+from coverage.exceptions import CoverageException, NoDataError
from coverage.misc import file_be_gone
from coverage.sqldata import CoverageData
@@ -72,7 +72,7 @@ def combinable_files(data_file, data_paths=None):
pattern = os.path.join(os.path.abspath(p), f"{local}.*")
files_to_combine.extend(glob.glob(pattern))
else:
- raise CoverageException(f"Couldn't combine from non-existent path '{p}'")
+ raise NoDataError(f"Couldn't combine from non-existent path '{p}'")
return files_to_combine
@@ -107,7 +107,7 @@ def combine_parallel_data(
files_to_combine = combinable_files(data.base_filename(), data_paths)
if strict and not files_to_combine:
- raise CoverageException("No data to combine")
+ raise NoDataError("No data to combine")
files_combined = 0
for f in files_to_combine:
@@ -138,4 +138,4 @@ def combine_parallel_data(
file_be_gone(f)
if strict and not files_combined:
- raise CoverageException("No usable data files")
+ raise NoDataError("No usable data files")