mirror of
https://github.com/home-assistant/core.git
synced 2025-11-07 18:09:31 +00:00
Raise and suppress stack trace when reloading yaml fails (#102410)
* Allow async_integration_yaml_config to raise * Docstr - split check * Implement as wrapper, return dataclass * Fix setup error handling * Fix reload test mock * Move log_messages to error handler * Remove unreachable code * Remove config test helper * Refactor and ensure notifications during setup * Remove redundat error, adjust tests notifications * Fix patch * Apply suggestions from code review Co-authored-by: Erik Montnemery <erik@montnemery.com> * Follow up comments * Add call_back decorator * Split long lines * Update exception abbreviations --------- Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
@@ -26,6 +26,31 @@ class HomeAssistantError(Exception):
|
||||
self.translation_placeholders = translation_placeholders
|
||||
|
||||
|
||||
class ConfigValidationError(HomeAssistantError, ExceptionGroup[Exception]):
|
||||
"""A validation exception occurred when validating the configuration."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
message: str,
|
||||
exceptions: list[Exception],
|
||||
translation_domain: str | None = None,
|
||||
translation_key: str | None = None,
|
||||
translation_placeholders: dict[str, str] | None = None,
|
||||
) -> None:
|
||||
"""Initialize exception."""
|
||||
super().__init__(
|
||||
*(message, exceptions),
|
||||
translation_domain=translation_domain,
|
||||
translation_key=translation_key,
|
||||
translation_placeholders=translation_placeholders,
|
||||
)
|
||||
self._message = message
|
||||
|
||||
def __str__(self) -> str:
|
||||
"""Return exception message string."""
|
||||
return self._message
|
||||
|
||||
|
||||
class ServiceValidationError(HomeAssistantError):
|
||||
"""A validation exception occurred when calling a service."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user