mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Catch unknown user exception in Overkiz integration (#76693)
This commit is contained in:
parent
083e902dc0
commit
c98ee412c0
@ -12,6 +12,7 @@ from pyoverkiz.exceptions import (
|
|||||||
MaintenanceException,
|
MaintenanceException,
|
||||||
TooManyAttemptsBannedException,
|
TooManyAttemptsBannedException,
|
||||||
TooManyRequestsException,
|
TooManyRequestsException,
|
||||||
|
UnknownUserException,
|
||||||
)
|
)
|
||||||
from pyoverkiz.models import obfuscate_id
|
from pyoverkiz.models import obfuscate_id
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -83,6 +84,8 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
errors["base"] = "server_in_maintenance"
|
errors["base"] = "server_in_maintenance"
|
||||||
except TooManyAttemptsBannedException:
|
except TooManyAttemptsBannedException:
|
||||||
errors["base"] = "too_many_attempts"
|
errors["base"] = "too_many_attempts"
|
||||||
|
except UnknownUserException:
|
||||||
|
errors["base"] = "unknown_user"
|
||||||
except Exception as exception: # pylint: disable=broad-except
|
except Exception as exception: # pylint: disable=broad-except
|
||||||
errors["base"] = "unknown"
|
errors["base"] = "unknown"
|
||||||
LOGGER.exception(exception)
|
LOGGER.exception(exception)
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
"server_in_maintenance": "Server is down for maintenance",
|
"server_in_maintenance": "Server is down for maintenance",
|
||||||
"too_many_attempts": "Too many attempts with an invalid token, temporarily banned",
|
"too_many_attempts": "Too many attempts with an invalid token, temporarily banned",
|
||||||
"too_many_requests": "Too many requests, try again later",
|
"too_many_requests": "Too many requests, try again later",
|
||||||
"unknown": "[%key:common::config_flow::error::unknown%]"
|
"unknown": "[%key:common::config_flow::error::unknown%]",
|
||||||
|
"unknown_user": "Unknown user. Somfy Protect accounts are not supported by this integration."
|
||||||
},
|
},
|
||||||
"abort": {
|
"abort": {
|
||||||
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]",
|
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]",
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
"server_in_maintenance": "Server is down for maintenance",
|
"server_in_maintenance": "Server is down for maintenance",
|
||||||
"too_many_attempts": "Too many attempts with an invalid token, temporarily banned",
|
"too_many_attempts": "Too many attempts with an invalid token, temporarily banned",
|
||||||
"too_many_requests": "Too many requests, try again later",
|
"too_many_requests": "Too many requests, try again later",
|
||||||
"unknown": "Unexpected error"
|
"unknown": "Unexpected error",
|
||||||
|
"unknown_user": "Unknown user. Somfy Protect accounts are not supported by this integration."
|
||||||
},
|
},
|
||||||
"flow_title": "Gateway: {gateway_id}",
|
"flow_title": "Gateway: {gateway_id}",
|
||||||
"step": {
|
"step": {
|
||||||
|
@ -9,6 +9,7 @@ from pyoverkiz.exceptions import (
|
|||||||
MaintenanceException,
|
MaintenanceException,
|
||||||
TooManyAttemptsBannedException,
|
TooManyAttemptsBannedException,
|
||||||
TooManyRequestsException,
|
TooManyRequestsException,
|
||||||
|
UnknownUserException,
|
||||||
)
|
)
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@ -88,6 +89,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
|||||||
(ClientError, "cannot_connect"),
|
(ClientError, "cannot_connect"),
|
||||||
(MaintenanceException, "server_in_maintenance"),
|
(MaintenanceException, "server_in_maintenance"),
|
||||||
(TooManyAttemptsBannedException, "too_many_attempts"),
|
(TooManyAttemptsBannedException, "too_many_attempts"),
|
||||||
|
(UnknownUserException, "unknown_user"),
|
||||||
(Exception, "unknown"),
|
(Exception, "unknown"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user