diff options
author | Prince Roshan <princekrroshan01@gmail.com> | 2023-05-20 22:26:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-20 22:26:49 (GMT) |
commit | 12f1581b0c43f40a792c188e17d2dea2357debb3 (patch) | |
tree | 8fe49fd21b2b75f5fce951216c25ad42fafebd18 /Lib/logging | |
parent | 27a68be77f7a5bfb7c4b97438571b4fcf5aae8b4 (diff) | |
download | cpython-12f1581b0c43f40a792c188e17d2dea2357debb3.zip cpython-12f1581b0c43f40a792c188e17d2dea2357debb3.tar.gz cpython-12f1581b0c43f40a792c188e17d2dea2357debb3.tar.bz2 |
gh-103606: raise RuntimeError if config file is invalid or empty (#104701)
(this adjusts new code) raise RuntimeError if provided config file is invalid or empty, not ValueError.
Diffstat (limited to 'Lib/logging')
-rw-r--r-- | Lib/logging/config.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/logging/config.py b/Lib/logging/config.py index 652f21e..a68281d 100644 --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -65,7 +65,7 @@ def fileConfig(fname, defaults=None, disable_existing_loggers=True, encoding=Non if not os.path.exists(fname): raise FileNotFoundError(f"{fname} doesn't exist") elif not os.path.getsize(fname): - raise ValueError(f'{fname} is an empty file') + raise RuntimeError(f'{fname} is an empty file') if isinstance(fname, configparser.RawConfigParser): cp = fname @@ -78,7 +78,7 @@ def fileConfig(fname, defaults=None, disable_existing_loggers=True, encoding=Non encoding = io.text_encoding(encoding) cp.read(fname, encoding=encoding) except configparser.ParsingError as e: - raise ValueError(f'{fname} is invalid: {e}') + raise RuntimeError(f'{fname} is invalid: {e}') formatters = _create_formatters(cp) |