mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Jewish Calendar: Make exception translatable (#145376)
This commit is contained in:
parent
cb717c0ec6
commit
bbd223af1f
@ -16,6 +16,7 @@ from homeassistant.core import (
|
||||
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
|
||||
@ -48,7 +49,9 @@ def async_setup_services(hass: HomeAssistant) -> None:
|
||||
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(
|
||||
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
|
||||
|
@ -185,5 +185,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"exceptions": {
|
||||
"sunset_event": { "message": "Can't get sunset event date" }
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user