diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-11-13 19:23:24 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-11-14 11:41:23 -0500 |
commit | 1c29ef3e4b871508bb2defd6b47b9a745547b626 (patch) | |
tree | 931fd2d7175321fd1549fd32e378cddcc99d2537 /coverage/exceptions.py | |
parent | 342e7da2941ae5291f1a94b6ad66ce489f6985fe (diff) | |
download | python-coveragepy-git-1c29ef3e4b871508bb2defd6b47b9a745547b626.tar.gz |
refactor: specialize 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.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/coverage/exceptions.py b/coverage/exceptions.py index de2257a1..c6a7f3da 100644 --- a/coverage/exceptions.py +++ b/coverage/exceptions.py @@ -5,12 +5,26 @@ class _BaseCoverageException(Exception): - """The base of all Coverage exceptions.""" + """The base-base of all Coverage exceptions.""" pass class CoverageException(_BaseCoverageException): - """An exception raised by a coverage.py function.""" + """The base class of all exceptions raised by Coverage.py.""" + 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 @@ -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. |