Mercurial > personal > weather-server
diff weather_server/locations.py @ 9:f1ea183d28ba
Give a 404 rather than a 500 on missing locations.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sun, 29 Sep 2019 20:34:38 -0400 |
parents | f66df122f18d |
children | beb42c835c52 |
line wrap: on
line diff
--- a/weather_server/locations.py Sun Sep 29 20:32:48 2019 -0400 +++ b/weather_server/locations.py Sun Sep 29 20:34:38 2019 -0400 @@ -47,8 +47,7 @@ def get(self, name) -> t.Tuple[LocationInfo, logfile.Logger]: try: directory = self._path / name - return ( - LocationInfo.load(directory / CONFIG_FILE), - logfile.Logger.create(str(directory / LOG))) + logger = logfile.Logger.create(str(directory / LOG)) + return (LocationInfo.load(directory / CONFIG_FILE), logger) except OSError: raise KeyError(name)