Improve the dahboard 6
This commit is contained in:
13
services/external/app/api/weather.py
vendored
13
services/external/app/api/weather.py
vendored
@@ -51,7 +51,7 @@ async def get_current_weather(
|
||||
weather = await weather_service.get_current_weather(latitude, longitude)
|
||||
|
||||
if not weather:
|
||||
raise HTTPException(status_code=404, detail="Weather data not available")
|
||||
raise HTTPException(status_code=503, detail="Weather service temporarily unavailable")
|
||||
|
||||
# Publish event
|
||||
try:
|
||||
@@ -133,8 +133,10 @@ async def get_weather_forecast(
|
||||
|
||||
forecast = await weather_service.get_weather_forecast(request.latitude, request.longitude, request.days)
|
||||
|
||||
# Don't return 404 for empty forecast - return empty list with 200 status
|
||||
if not forecast:
|
||||
raise HTTPException(status_code=404, detail="Weather forecast not available")
|
||||
logger.info("Weather forecast unavailable - returning empty list")
|
||||
return []
|
||||
|
||||
# Publish event
|
||||
try:
|
||||
@@ -180,11 +182,10 @@ async def get_hourly_weather_forecast(
|
||||
request.latitude, request.longitude, request.hours
|
||||
)
|
||||
|
||||
# Don't return 404 for empty hourly forecast - return empty list with 200 status
|
||||
if not hourly_forecast:
|
||||
raise HTTPException(
|
||||
status_code=404,
|
||||
detail="Hourly weather forecast not available. Please check AEMET API configuration."
|
||||
)
|
||||
logger.info("Hourly weather forecast unavailable - returning empty list")
|
||||
return []
|
||||
|
||||
# Publish event
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user