changeset 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 d54155a199d8
children 6d59f038a58b
files weather_server/locations.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
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)