| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -88,7 +88,7 @@ in :mod:`logging` itself) and defining handlers which are declared either in | |||
| 88 | 88 | configuration). | |
| 89 | 89 | ||
| 90 | 90 | It will raise :exc:`FileNotFoundError` if the file | |
| 91 | - doesn't exist and :exc:`ValueError` if the file is invalid or | ||
| 91 | + doesn't exist and :exc:`RuntimeError` if the file is invalid or | ||
| 92 | 92 | empty. | |
| 93 | 93 | ||
| 94 | 94 | :param fname: A filename, or a file-like object, or an instance derived | |
@@ -130,7 +130,7 @@ in :mod:`logging` itself) and defining handlers which are declared either in | |||
| 130 | 130 | .. versionadded:: 3.10 | |
| 131 | 131 | The *encoding* parameter is added. | |
| 132 | 132 | ||
| 133 | - .. versionadded:: 3.12 | ||
| 133 | + .. versionchanged:: 3.12 | ||
| 134 | 134 | An exception will be thrown if the provided file | |
| 135 | 135 | doesn't exist or is invalid or empty. | |
| 136 | 136 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -65,7 +65,7 @@ def fileConfig(fname, defaults=None, disable_existing_loggers=True, encoding=Non | |||
| 65 | 65 | if not os.path.exists(fname): | |
| 66 | 66 | raise FileNotFoundError(f"{fname} doesn't exist") | |
| 67 | 67 | elif not os.path.getsize(fname): | |
| 68 | - raise ValueError(f'{fname} is an empty file') | ||
| 68 | + raise RuntimeError(f'{fname} is an empty file') | ||
| 69 | 69 | ||
| 70 | 70 | if isinstance(fname, configparser.RawConfigParser): | |
| 71 | 71 | cp = fname | |
@@ -78,7 +78,7 @@ def fileConfig(fname, defaults=None, disable_existing_loggers=True, encoding=Non | |||
| 78 | 78 | encoding = io.text_encoding(encoding) | |
| 79 | 79 | cp.read(fname, encoding=encoding) | |
| 80 | 80 | except configparser.ParsingError as e: | |
| 81 | - raise ValueError(f'{fname} is invalid: {e}') | ||
| 81 | + raise RuntimeError(f'{fname} is invalid: {e}') | ||
| 82 | 82 | ||
| 83 | 83 | formatters = _create_formatters(cp) | |
| 84 | 84 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1781,12 +1781,12 @@ def test_exception_if_confg_file_is_invalid(self): | |||
| 1781 | 1781 | """ | |
| 1782 | 1782 | ||
| 1783 | 1783 | file = io.StringIO(textwrap.dedent(test_config)) | |
| 1784 | - self.assertRaises(ValueError, logging.config.fileConfig, file) | ||
| 1784 | + self.assertRaises(RuntimeError, logging.config.fileConfig, file) | ||
| 1785 | 1785 | ||
| 1786 | 1786 | def test_exception_if_confg_file_is_empty(self): | |
| 1787 | 1787 | fd, fn = tempfile.mkstemp(prefix='test_empty_', suffix='.ini') | |
| 1788 | 1788 | os.close(fd) | |
| 1789 | - self.assertRaises(ValueError, logging.config.fileConfig, fn) | ||
| 1789 | + self.assertRaises(RuntimeError, logging.config.fileConfig, fn) | ||
| 1790 | 1790 | os.remove(fn) | |
| 1791 | 1791 | ||
| 1792 | 1792 | def test_exception_if_config_file_does_not_exist(self): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments