We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 626ab8f commit 7283815Copy full SHA for 7283815
app/router/locations.py
@@ -1,4 +1,4 @@
1
-from fastapi import Request
+from fastapi import Request, HTTPException
2
from . import router
3
from ..enums.sources import Sources
4
from ..models.location import LocationResponse as Location, LocationsResponse as Locations
@@ -38,6 +38,8 @@ def get_locations(
38
locations = [location for location in locations if str(getattr(location, key)).lower() == str(value)]
39
except AttributeError:
40
pass
41
+ if not locations:
42
+ raise HTTPException(404, detail=f"Source `{source}` does not have the desired location data.")
43
44
# Return final serialized data.
45
return {
0 commit comments