mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Take Huawei LTE XML parse errors to mean unsupported endpoint (#72781)
This commit is contained in:
parent
efbd47c828
commit
1a55c7db34
@ -9,6 +9,7 @@ from datetime import timedelta
|
|||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
from typing import Any, NamedTuple, cast
|
from typing import Any, NamedTuple, cast
|
||||||
|
from xml.parsers.expat import ExpatError
|
||||||
|
|
||||||
from huawei_lte_api.Client import Client
|
from huawei_lte_api.Client import Client
|
||||||
from huawei_lte_api.Connection import Connection
|
from huawei_lte_api.Connection import Connection
|
||||||
@ -204,14 +205,13 @@ class Router:
|
|||||||
"%s requires authorization, excluding from future updates", key
|
"%s requires authorization, excluding from future updates", key
|
||||||
)
|
)
|
||||||
self.subscriptions.pop(key)
|
self.subscriptions.pop(key)
|
||||||
except ResponseErrorException as exc:
|
except (ResponseErrorException, ExpatError) as exc:
|
||||||
|
# Take ResponseErrorNotSupportedException, ExpatError, and generic
|
||||||
|
# ResponseErrorException with a few select codes to mean the endpoint is
|
||||||
|
# not supported.
|
||||||
if not isinstance(
|
if not isinstance(
|
||||||
exc, ResponseErrorNotSupportedException
|
exc, (ResponseErrorNotSupportedException, ExpatError)
|
||||||
) and exc.code not in (
|
) and exc.code not in (-1, 100006):
|
||||||
# additional codes treated as unusupported
|
|
||||||
-1,
|
|
||||||
100006,
|
|
||||||
):
|
|
||||||
raise
|
raise
|
||||||
_LOGGER.info(
|
_LOGGER.info(
|
||||||
"%s apparently not supported by device, excluding from future updates",
|
"%s apparently not supported by device, excluding from future updates",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user