Fetch ServiceNotFound message from translation cache and fix super (#114084)

* Fetch ServiceNotFound message from translation cache and fix super

* Fix tests trace component

* Fix script errors
This commit is contained in:
Jan Bouwhuis
2024-03-24 18:41:13 +01:00
committed by GitHub
parent 6371b344b9
commit 67ab49b825
4 changed files with 17 additions and 15 deletions

View File

@@ -260,17 +260,13 @@ class ServiceNotFound(HomeAssistantError):
def __init__(self, domain: str, service: str) -> None:
"""Initialize error."""
super().__init__(
self,
translation_domain="homeassistant",
translation_key="service_not_found",
translation_placeholders={"domain": domain, "service": service},
)
self.domain = domain
self.service = service
def __str__(self) -> str:
"""Return string representation."""
return f"Service {self.domain}.{self.service} not found."
self.generate_message = True
class MaxLengthExceeded(HomeAssistantError):
@@ -279,7 +275,6 @@ class MaxLengthExceeded(HomeAssistantError):
def __init__(self, value: str, property_name: str, max_length: int) -> None:
"""Initialize error."""
super().__init__(
self,
translation_domain="homeassistant",
translation_key="max_length_exceeded",
translation_placeholders={
@@ -300,7 +295,6 @@ class DependencyError(HomeAssistantError):
def __init__(self, failed_dependencies: list[str]) -> None:
"""Initialize error."""
super().__init__(
self,
f"Could not setup dependencies: {', '.join(failed_dependencies)}",
)
self.failed_dependencies = failed_dependencies