Expose more Websocket API constants (#42263)
This commit is contained in:
parent
c157a582b8
commit
de12ac354a
3 changed files with 64 additions and 13 deletions
|
@ -5,7 +5,7 @@ from typing import Any, Callable, Dict, Hashable, Optional
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import Context, callback
|
||||
from homeassistant.exceptions import Unauthorized
|
||||
from homeassistant.exceptions import HomeAssistantError, Unauthorized
|
||||
|
||||
from . import const, messages
|
||||
|
||||
|
@ -118,6 +118,9 @@ class ActiveConnection:
|
|||
elif isinstance(err, asyncio.TimeoutError):
|
||||
code = const.ERR_TIMEOUT
|
||||
err_message = "Timeout"
|
||||
elif isinstance(err, HomeAssistantError):
|
||||
code = const.ERR_UNKNOWN_ERROR
|
||||
err_message = str(err)
|
||||
else:
|
||||
code = const.ERR_UNKNOWN_ERROR
|
||||
err_message = "Unknown error"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue