aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2020-08-07 08:49:03 -0500
committerEugene Triguba <eugenetriguba@gmail.com>2020-08-07 08:49:03 -0500
commitc24f1741a91950480fd169a6583e6c2b675ee08e (patch)
treebf0db7af8707848bd4559c4ffcc83d8160dab1c4
parentAdd ParsingError to __init__ (diff)
downloadconfig-file-c24f1741a91950480fd169a6583e6c2b675ee08e.zip
Change UnsupportedFileTypeError to ValueError
-rw-r--r--config_file/config_file_path.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/config_file/config_file_path.py b/config_file/config_file_path.py
index 42466d9..11a5daa 100644
--- a/config_file/config_file_path.py
+++ b/config_file/config_file_path.py
@@ -9,7 +9,6 @@ from config_file.json_parser import JsonParser
from config_file.toml_parser import TomlParser
from config_file.yaml_parser import YamlParser
-from .exceptions import UnsupportedFileTypeError
from .utils import split_on_dot
@@ -58,14 +57,13 @@ class ConfigFilePath(_Path_):
"""Determine what parser should be used for this file.
Raises:
- UnsupportedFileTypeError: If the extension of the file
- is not recognized.
+ ValueError: If the extension of the file is not recognized.
Returns:
The instantiated parser that should be used for this file.
"""
if self.extension == "":
- raise UnsupportedFileTypeError(
+ raise ValueError(
"Tried to determine a parser to use, but the file at "
f"{self} does not have an extension."
)
@@ -79,7 +77,7 @@ class ConfigFilePath(_Path_):
elif self.extension == "toml":
return TomlParser(self.contents)
else:
- raise UnsupportedFileTypeError(
+ raise ValueError(
f"File path at `{self}` contains an unrecognized file type."
)