Skip to content

Commit

Permalink
add: Error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Drazzilb08 committed Feb 18, 2024
1 parent 928247d commit e7cbef7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions util/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,15 @@ def load_config(self):
"""
# Open the YAML config file and load its contents
try:
with open(self.config_path, "r") as file:
config = yaml.safe_load(file)
try:
with open(self.config_path, "r") as file:
config = yaml.safe_load(file)
except FileNotFoundError:
logger.error(f"Config file not found at {self.config_path}")
return
except yaml.parser.ParserError as e:
logger.error(f"Error parsing config file: {e}")
return
except FileNotFoundError:
logger.error(f"Config file not found at {self.config_path}")
return
Expand Down

0 comments on commit e7cbef7

Please sign in to comment.