Browse Source

Misc cleanup

Kirk Trombley 4 years ago
parent
commit
d7eeda7f06

+ 1 - 2
server/app/api/game.py

@@ -35,8 +35,7 @@ async def create_game(config: GameConfig, bg: BackgroundTasks, db: Session = Dep
     try:
         coords = await points.get_points(config)
     except ExhaustedSourceError:
-        logger.exception("")
-        # TODO might be worth logging something useful here eventually
+        logger.exception(f"Failed to generate enough points for {config}")
         raise HTTPException(status_code=501, detail="Sufficient points could not be generated quickly enough")
     game_id = queries.create_game(db, config, coords)
     bg.add_task(points.restock_source, config)

+ 1 - 1
server/app/point_gen/__init__.py

@@ -44,7 +44,7 @@ class PointStore:
                 return await urban_coord_unlocked()
             return await urban_coord_ensured(country, city_retries=50)
         else:
-            raise ExhaustedSourceError()
+            raise ExhaustedSourceError
 
     async def get_point(self, generator: GenMethodEnum, country: Union[CountryCode, None]) -> Tuple[str, float, float]:
         if country is not None:

+ 1 - 1
server/app/point_gen/random_street_view.py

@@ -51,4 +51,4 @@ async def call_random_street_view(country_lock, max_attempts=5):
         if len(points) > 0:
             return points
     else:
-        raise ExhaustedSourceError()
+        raise ExhaustedSourceError

+ 1 - 2
server/app/point_gen/shared.py

@@ -33,5 +33,4 @@ async def point_has_streetview(lat, lng):
 
 
 class ExhaustedSourceError(Exception):
-    def __init__(self, partial=[]):
-        self.partial = partial
+    pass

+ 2 - 2
server/app/point_gen/urban_centers.py

@@ -81,7 +81,7 @@ async def urban_coord_unlocked(country_retries=30, city_retries=10, point_retrie
         if pt is not None:
             return pt
     else:
-        raise ExhaustedSourceError()
+        raise ExhaustedSourceError
 
 
 async def urban_coord_ensured(country_lock, max_attempts=30, city_retries=10, point_retries=10, max_dist_km=25):
@@ -99,4 +99,4 @@ async def urban_coord_ensured(country_lock, max_attempts=30, city_retries=10, po
         if pt is not None:
             return pt
     else:
-        raise ExhaustedSourceError(points)
+        raise ExhaustedSourceError