mirror of
https://github.com/home-assistant/core.git
synced 2026-09-25 07:51:46 -05:00
Improve error messages in remote_calendar (#181571)
This commit is contained in:
@@ -80,5 +80,4 @@ class RemoteCalendarDataUpdateCoordinator(DataUpdateCoordinator[Calendar]):
|
||||
raise UpdateFailed(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="unable_to_parse",
|
||||
translation_placeholders={"err": str(err)},
|
||||
) from err
|
||||
|
||||
@@ -39,6 +39,6 @@ async def parse_calendar(hass: HomeAssistant, ics: str) -> Calendar:
|
||||
try:
|
||||
return await hass.async_add_executor_job(_compat_calendar_from_ics, ics)
|
||||
except CalendarParseError as err:
|
||||
_LOGGER.error("Error parsing calendar information: %s", err.message)
|
||||
_LOGGER.error("The remote calendar feed contains invalid data: %s", err.message)
|
||||
_LOGGER.debug("Additional calendar error detail: %s", str(err.detailed_error))
|
||||
raise InvalidIcsException(err.message) from err
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||
"forbidden": "The server understood the request but refuses to authorize it.",
|
||||
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
|
||||
"invalid_ics_file": "There was a problem reading the calendar information. See the error log for additional details.",
|
||||
"invalid_ics_file": "The remote calendar feed contains invalid data. See the error log for additional details.",
|
||||
"timeout_connect": "[%key:common::config_flow::error::timeout_connect%]"
|
||||
},
|
||||
"step": {
|
||||
@@ -47,7 +47,7 @@
|
||||
"message": "Unable to fetch calendar data. See the debug log for additional details."
|
||||
},
|
||||
"unable_to_parse": {
|
||||
"message": "Unable to parse calendar data: {err}"
|
||||
"message": "The remote calendar feed contains invalid data. See the error log for additional details."
|
||||
}
|
||||
},
|
||||
"title": "Remote Calendar"
|
||||
|
||||
@@ -85,6 +85,7 @@ async def test_update_failed(
|
||||
async def test_calendar_parse_error(
|
||||
hass: HomeAssistant,
|
||||
config_entry: MockConfigEntry,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test CalendarParseError using respx."""
|
||||
respx.get(CALENDER_URL).mock(
|
||||
@@ -92,6 +93,7 @@ async def test_calendar_parse_error(
|
||||
)
|
||||
await setup_integration(hass, config_entry)
|
||||
assert config_entry.state is ConfigEntryState.SETUP_RETRY
|
||||
assert "The remote calendar feed contains invalid data:" in caplog.text
|
||||
|
||||
|
||||
@respx.mock
|
||||
|
||||
Reference in New Issue
Block a user