mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 18:39:30 +00:00
RFC: Call services directly (#18720)
* Call services directly * Simplify * Type * Lint * Update name * Fix tests * Catch exceptions in HTTP view * Lint * Handle ServiceNotFound in API endpoints that call services * Type * Don't crash recorder on non-JSON serializable objects
This commit is contained in:
committed by
Pascal Vizeli
parent
53cbb28926
commit
df21dd21f2
@@ -58,3 +58,14 @@ class Unauthorized(HomeAssistantError):
|
||||
|
||||
class UnknownUser(Unauthorized):
|
||||
"""When call is made with user ID that doesn't exist."""
|
||||
|
||||
|
||||
class ServiceNotFound(HomeAssistantError):
|
||||
"""Raised when a service is not found."""
|
||||
|
||||
def __init__(self, domain: str, service: str) -> None:
|
||||
"""Initialize error."""
|
||||
super().__init__(
|
||||
self, "Service {}.{} not found".format(domain, service))
|
||||
self.domain = domain
|
||||
self.service = service
|
||||
|
||||
Reference in New Issue
Block a user