Skip to content

Commit f9c4f4b

Browse files
committed
Rework and bump version
1 parent 5ad1754 commit f9c4f4b

File tree

2 files changed

+29
-13
lines changed

2 files changed

+29
-13
lines changed

airos/airos8.py

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from urllib.parse import urlparse
1010

1111
import aiohttp
12+
from aiohttp.client_exceptions import ClientConnectorError
1213
from mashumaro.exceptions import InvalidFieldValue, MissingField
1314

1415
from .data import AirOS8Data as AirOSData, redact_data_smart
@@ -186,12 +187,16 @@ async def login(self) -> bool:
186187
log = f"Login failed with status {response.status}. Full Response: {response.text}"
187188
_LOGGER.error(log)
188189
raise AirOSConnectionAuthenticationError from None
189-
except (TimeoutError, aiohttp.ClientError) as err:
190-
_LOGGER.exception("Error during login")
191-
raise AirOSDeviceConnectionError from err
190+
192191
except asyncio.CancelledError:
193192
_LOGGER.info("Login task was cancelled")
194193
raise
194+
except (TimeoutError, ClientConnectorError) as err:
195+
_LOGGER.exception("Error during login")
196+
raise AirOSDeviceConnectionError from err
197+
except aiohttp.ClientError as err:
198+
_LOGGER.exception("Unexpected client error during login")
199+
raise AirOSDeviceConnectionError from err
195200

196201
def derived_data(
197202
self, response: dict[str, Any] | None = None
@@ -302,12 +307,15 @@ async def status(self) -> AirOSData:
302307
response_text,
303308
)
304309
raise AirOSDeviceConnectionError
305-
except (TimeoutError, aiohttp.ClientError) as err:
306-
_LOGGER.exception("Status API call failed: %s", err)
307-
raise AirOSDeviceConnectionError from err
308310
except asyncio.CancelledError:
309311
_LOGGER.info("API status retrieval task was cancelled")
310312
raise
313+
except (TimeoutError, ClientConnectorError) as err:
314+
_LOGGER.exception("Status API call failed: %s", err)
315+
raise AirOSDeviceConnectionError from err
316+
except aiohttp.ClientError as err:
317+
_LOGGER.exception("Unexpected client error during status API call")
318+
raise AirOSDeviceConnectionError from err
311319

312320
async def stakick(self, mac_address: str = None) -> bool:
313321
"""Reconnect client station."""
@@ -340,12 +348,16 @@ async def stakick(self, mac_address: str = None) -> bool:
340348
log = f"Unable to restart connection response status {response.status} with {response_text}"
341349
_LOGGER.error(log)
342350
return False
343-
except (TimeoutError, aiohttp.ClientError) as err:
344-
_LOGGER.exception("Error during call to reconnect remote: %s", err)
345-
raise AirOSDeviceConnectionError from err
351+
346352
except asyncio.CancelledError:
347353
_LOGGER.info("Reconnect task was cancelled")
348354
raise
355+
except (TimeoutError, ClientConnectorError) as err:
356+
_LOGGER.exception("Error during call to reconnect remote: %s", err)
357+
raise AirOSDeviceConnectionError from err
358+
except aiohttp.ClientError as err:
359+
_LOGGER.exception("Unexpected client error reconnect request")
360+
raise AirOSDeviceConnectionError from err
349361

350362
async def provmode(self, active: bool = False) -> bool:
351363
"""Set provisioning mode."""
@@ -379,9 +391,13 @@ async def provmode(self, active: bool = False) -> bool:
379391
log = f"Unable to change provisioning mode response status {response.status} with {response_text}"
380392
_LOGGER.error(log)
381393
return False
382-
except (TimeoutError, aiohttp.ClientError) as err:
383-
_LOGGER.exception("Error during call to change provisioning mode: %s", err)
384-
raise AirOSDeviceConnectionError from err
394+
385395
except asyncio.CancelledError:
386396
_LOGGER.info("Provisioning mode change task was cancelled")
387397
raise
398+
except (TimeoutError, ClientConnectorError) as err:
399+
_LOGGER.exception("Error during call to change provisioning mode: %s", err)
400+
raise AirOSDeviceConnectionError from err
401+
except aiohttp.ClientError as err:
402+
_LOGGER.exception("Unexpected client error changing provisioning mode")
403+
raise AirOSDeviceConnectionError from err

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "airos"
7-
version = "0.2.8a0"
7+
version = "0.2.8a1"
88
license = "MIT"
99
description = "Ubiquity airOS module(s) for Python 3."
1010
readme = "README.md"

0 commit comments

Comments
 (0)