Skip to content

Commit

Permalink
Catch toml parsing errors and report filename that was being read
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinmacaulay committed Aug 23, 2024
1 parent 66ffab6 commit b3903cb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/echosms/referencemodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ def __init__(self):
self.definitions = []

with open(self.defs_filename, 'rb') as f:
self.definitions = tomllib.load(f)
try:
self.definitions = tomllib.load(f)
except tomllib.TOMLDecodeError as e:
raise Exception(f'Error while parsing file "{self.defs_filename.name}"') from e

# Flag duplicate target names
pda = pd.Series(self.names())
Expand Down

0 comments on commit b3903cb

Please sign in to comment.