Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion homeassistant/components/jewish_calendar/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
ServiceResponse,
SupportsResponse,
)
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.selector import LanguageSelector, LanguageSelectorConfig
from homeassistant.helpers.sun import get_astral_event_date
Expand Down Expand Up @@ -48,7 +49,9 @@
event_date = get_astral_event_date(hass, SUN_EVENT_SUNSET, today)
if event_date is None:
_LOGGER.error("Can't get sunset event date for %s", today)
raise ValueError("Can't get sunset event date")
raise HomeAssistantError(

Check warning on line 52 in homeassistant/components/jewish_calendar/service.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/jewish_calendar/service.py#L52

Added line #L52 was not covered by tests
translation_domain=DOMAIN, translation_key="sunset_event"
)
sunset = dt_util.as_local(event_date)
_LOGGER.debug("Now: %s Sunset: %s", now, sunset)
return now > sunset
Expand Down
3 changes: 3 additions & 0 deletions homeassistant/components/jewish_calendar/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,5 +185,8 @@
}
}
}
},
"exceptions": {
"sunset_event": { "message": "Can't get sunset event date" }
}
}