i2mint / py2store

Tools to create simple and consistent interfaces to complicated and varied data sources.
MIT License
11 stars 2 forks source link

Make `myconfigs` key errors more helpful #78

Closed thorwhalen closed 3 years ago

thorwhalen commented 3 years ago

Have myconfigs key error explicitly say "hey, you need to have a file named X in your Y directory".

thorwhalen commented 3 years ago

Added

                def __getitem__(self, k):
                    try:
                        return super().__getitem__(k)
                    except KeyError:
                        raise KeyError(f"The '{k}' key wasn't found. "
                                       f"What this probably is, is that you need "
                                       f"a file named '{k}' in your {self.dirpath} folder. Do that and try again.")

to MyConfigs class