summaryrefslogtreecommitdiff
path: root/coverage/tomlconfig.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 11:41:23 -0500
commit1c29ef3e4b871508bb2defd6b47b9a745547b626 (patch)
tree931fd2d7175321fd1549fd32e378cddcc99d2537 /coverage/tomlconfig.py
parent342e7da2941ae5291f1a94b6ad66ce489f6985fe (diff)
downloadpython-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/tomlconfig.py')
-rw-r--r--coverage/tomlconfig.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/coverage/tomlconfig.py b/coverage/tomlconfig.py
index 4a1e322c..a06da65f 100644
--- a/coverage/tomlconfig.py
+++ b/coverage/tomlconfig.py
@@ -7,7 +7,7 @@ import configparser
import os
import re
-from coverage.exceptions import CoverageException
+from coverage.exceptions import ConfigError
from coverage.misc import import_third_party, substitute_variables
# TOML support is an install-time extra option. (Import typing is here because
@@ -57,7 +57,7 @@ class TomlConfigParser:
if self.our_file or has_toml:
# Looks like they meant to read TOML, but we can't read it.
msg = "Can't read {!r} without TOML support. Install with [toml] extra"
- raise CoverageException(msg.format(filename))
+ raise ConfigError(msg.format(filename))
return []
def _get_section(self, section):
@@ -148,7 +148,7 @@ class TomlConfigParser:
try:
re.compile(value)
except re.error as e:
- raise CoverageException(f"Invalid [{name}].{option} value {value!r}: {e}") from e
+ raise ConfigError(f"Invalid [{name}].{option} value {value!r}: {e}") from e
return values
def getint(self, section, option):