mirror of https://gitlab.com/ceda_ei/sky
Fix 500 on unknown location
This commit is contained in:
parent
6ac1457f3a
commit
723fb81d28
|
@ -169,7 +169,7 @@ def main(location, geocoder, cache_db, kind, unit):
|
||||||
"Main function that returns the weather based on parameters"
|
"Main function that returns the weather based on parameters"
|
||||||
try:
|
try:
|
||||||
coordinates = get_coordinates(location, geocoder, cache_db)
|
coordinates = get_coordinates(location, geocoder, cache_db)
|
||||||
except KeyError:
|
except (IndexError, KeyError):
|
||||||
return "Location Not found"
|
return "Location Not found"
|
||||||
weather = get_weather(coordinates)
|
weather = get_weather(coordinates)
|
||||||
text = weather_to_text(weather, kind, unit, coordinates[2])
|
text = weather_to_text(weather, kind, unit, coordinates[2])
|
||||||
|
|
Loading…
Reference in New Issue