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:
parent
53cbb28926
commit
df21dd21f2
30 changed files with 312 additions and 186 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue