From 7c478473ddd3278dbbbd1520c6a290a270663e53 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sun, 16 Aug 2020 22:07:34 -0500 Subject: Document ParsingError and ConfigFile init errors --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 8beb1d2..52f731a 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,21 @@ from config_file import ConfigFile config = ConfigFile("~/some-project/config.ini") ``` +#### Handling ConfigFile Initialization Errors + +```python +from config_file import ConfigFile, ParsingError + +try: + config = ConfigFile("~/some-file.ini") +except ParsingError: + print("could not parse the file") +except ValueError: + print("extension that isn't supported was used or is a directory") +except FileNotFoundError: + print("file does not exist") +``` + ### Using `get()` A recurring pattern you'll see here is that all methods that -- cgit v1.2.3