mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 09:47:52 +00:00
Fix incorrect reference to json WriteError (#88161)
This commit is contained in:
parent
6c430e03bc
commit
a1b7842df2
@ -15,6 +15,7 @@ from homeassistant.const import EVENT_HOMEASSISTANT_FINAL_WRITE
|
||||
from homeassistant.core import CALLBACK_TYPE, CoreState, Event, HomeAssistant, callback
|
||||
from homeassistant.loader import MAX_LOAD_CONCURRENTLY, bind_hass
|
||||
from homeassistant.util import json as json_util
|
||||
from homeassistant.util.file import WriteError
|
||||
|
||||
# mypy: allow-untyped-calls, allow-untyped-defs, no-warn-return-any
|
||||
# mypy: no-check-untyped-defs
|
||||
@ -278,7 +279,7 @@ class Store(Generic[_T]):
|
||||
|
||||
try:
|
||||
await self._async_write_data(self.path, data)
|
||||
except (json_util.SerializationError, json_util.WriteError) as err:
|
||||
except (json_util.SerializationError, WriteError) as err:
|
||||
_LOGGER.error("Error writing config for %s: %s", self.key, err)
|
||||
|
||||
async def _async_write_data(self, path: str, data: dict) -> None:
|
||||
|
@ -16,7 +16,11 @@ from homeassistant.helpers.json import (
|
||||
json_encoder_default as default_hass_orjson_encoder,
|
||||
)
|
||||
|
||||
from .file import write_utf8_file, write_utf8_file_atomic
|
||||
from .file import ( # pylint: disable=unused-import # noqa: F401
|
||||
WriteError,
|
||||
write_utf8_file,
|
||||
write_utf8_file_atomic,
|
||||
)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -25,10 +29,6 @@ class SerializationError(HomeAssistantError):
|
||||
"""Error serializing the data to JSON."""
|
||||
|
||||
|
||||
class WriteError(HomeAssistantError):
|
||||
"""Error writing the data."""
|
||||
|
||||
|
||||
def load_json(filename: str, default: list | dict | None = None) -> list | dict:
|
||||
"""Load JSON data from a file and return as dict or list.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user