Improve Alexa error handling (#24745)
This commit is contained in:
1 parent
d4fc22add4
commit
f5f86993f1
8 files changed
+121
-9
No files matched your search
@@ -1,4 +1,5 @@
|
||||
"""Connection session."""
|
||||
import asyncio
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import callback, Context
|
||||
@@ -101,6 +102,9 @@ class ActiveConnection:
|
||||
elif isinstance(err, vol.Invalid):
|
||||
code = const.ERR_INVALID_FORMAT
|
||||
err_message = vol.humanize.humanize_error(msg, err)
|
||||
elif isinstance(err, asyncio.TimeoutError):
|
||||
code = const.ERR_TIMEOUT
|
||||
err_message = 'Timeout'
|
||||
else:
|
||||
code = const.ERR_UNKNOWN_ERROR
|
||||
err_message = 'Unknown error'
|
||||
|
||||
@@ -16,6 +16,7 @@ ERR_HOME_ASSISTANT_ERROR = 'home_assistant_error'
|
||||
ERR_UNKNOWN_COMMAND = 'unknown_command'
|
||||
ERR_UNKNOWN_ERROR = 'unknown_error'
|
||||
ERR_UNAUTHORIZED = 'unauthorized'
|
||||
ERR_TIMEOUT = 'timeout'
|
||||
|
||||
TYPE_RESULT = 'result'
|
||||
|
||||
|
||||
Reference in new issue
Block a user