summaryrefslogtreecommitdiff
path: root/coverage/exceptions.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/exceptions.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/exceptions.py')
-rw-r--r--coverage/exceptions.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/coverage/exceptions.py b/coverage/exceptions.py
index de2257a1..7352e9fc 100644
--- a/coverage/exceptions.py
+++ b/coverage/exceptions.py
@@ -14,6 +14,20 @@ class CoverageException(_BaseCoverageException):
pass
+class ConfigError(_BaseCoverageException):
+ """A problem with a config file, or a value in one."""
+ pass
+
+
+class DataError(CoverageException):
+ """An error in using a data file."""
+ pass
+
+class NoDataError(CoverageException):
+ """We didn't have data to work with."""
+ pass
+
+
class NoSource(CoverageException):
"""We couldn't find the source for a module."""
pass
@@ -29,6 +43,11 @@ class NotPython(CoverageException):
pass
+class PluginError(CoverageException):
+ """A plugin misbehaved."""
+ pass
+
+
class _ExceptionDuringRun(CoverageException):
"""An exception happened while running customer code.