mirror of
https://github.com/home-assistant/core.git
synced 2025-11-10 03:19:34 +00:00
Include filename in exception when loading a json file fails (#111802)
* Include filename in exception when loading a json file fails * fix
This commit is contained in:
@@ -79,12 +79,12 @@ def load_json(
|
||||
except FileNotFoundError:
|
||||
# This is not a fatal error
|
||||
_LOGGER.debug("JSON file not found: %s", filename)
|
||||
except ValueError as error:
|
||||
except JSON_DECODE_EXCEPTIONS as error:
|
||||
_LOGGER.exception("Could not parse JSON content: %s", filename)
|
||||
raise HomeAssistantError(error) from error
|
||||
raise HomeAssistantError(f"Error while loading {filename}: {error}") from error
|
||||
except OSError as error:
|
||||
_LOGGER.exception("JSON file reading failed: %s", filename)
|
||||
raise HomeAssistantError(error) from error
|
||||
raise HomeAssistantError(f"Error while loading {filename}: {error}") from error
|
||||
return {} if default is _SENTINEL else default
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user