forked from home-assistant/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Converge stream av open methods, options, and error handling (home-as…
…sistant#134020) * Converge stream av open methods, options, and error handling * Remove exception that is never thrown * Update exceptions thrown in generic tests * Increase stream test coverage
- Loading branch information
1 parent
07ae9b1
commit 6edf06f
Showing
13 changed files
with
267 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""Stream component exceptions.""" | ||
|
||
from homeassistant.exceptions import HomeAssistantError | ||
|
||
from .const import StreamClientError | ||
|
||
|
||
class StreamOpenClientError(HomeAssistantError): | ||
"""Raised when client error received when trying to open a stream. | ||
:param stream_client_error: The type of client error | ||
""" | ||
|
||
def __init__(self, message: str, error_code: StreamClientError) -> None: | ||
"""Initialize a stream open client error.""" | ||
super().__init__(message) | ||
self.error_code = error_code | ||
|
||
|
||
class StreamWorkerError(Exception): | ||
"""An exception thrown while processing a stream.""" | ||
|
||
def __init__( | ||
self, message: str, error_code: StreamClientError = StreamClientError.Other | ||
) -> None: | ||
"""Initialize a stream worker error.""" | ||
super().__init__(message) | ||
self.error_code = error_code | ||
|
||
|
||
class StreamEndedError(StreamWorkerError): | ||
"""Raised when the stream is complete, exposed for facilitating testing.""" |
Oops, something went wrong.