mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-21 14:58:02 +00:00
Rename and deprecate exception classes (#739)
# Public # SmartDeviceException -> KasaException UnsupportedDeviceException(SmartDeviceException) -> UnsupportedDeviceError(KasaException) TimeoutException(SmartDeviceException, asyncio.TimeoutError) -> TimeoutError(KasaException, asyncio.TimeoutError) Add new exception for error codes -> DeviceError(KasaException) AuthenticationException(SmartDeviceException) -> AuthenticationError(DeviceError) # Internal # RetryableException(SmartDeviceException) -> _RetryableError(DeviceError) ConnectionException(SmartDeviceException) -> _ConnectionError(KasaException)
This commit is contained in:
@@ -6,9 +6,9 @@ import pytest
|
||||
|
||||
from ..deviceconfig import DeviceConfig
|
||||
from ..exceptions import (
|
||||
ConnectionException,
|
||||
SmartDeviceException,
|
||||
TimeoutException,
|
||||
KasaException,
|
||||
TimeoutError,
|
||||
_ConnectionError,
|
||||
)
|
||||
from ..httpclient import HttpClient
|
||||
|
||||
@@ -18,28 +18,28 @@ from ..httpclient import HttpClient
|
||||
[
|
||||
(
|
||||
aiohttp.ServerDisconnectedError(),
|
||||
ConnectionException,
|
||||
_ConnectionError,
|
||||
"Device connection error: ",
|
||||
),
|
||||
(
|
||||
aiohttp.ClientOSError(),
|
||||
ConnectionException,
|
||||
_ConnectionError,
|
||||
"Device connection error: ",
|
||||
),
|
||||
(
|
||||
aiohttp.ServerTimeoutError(),
|
||||
TimeoutException,
|
||||
TimeoutError,
|
||||
"Unable to query the device, timed out: ",
|
||||
),
|
||||
(
|
||||
asyncio.TimeoutError(),
|
||||
TimeoutException,
|
||||
TimeoutError,
|
||||
"Unable to query the device, timed out: ",
|
||||
),
|
||||
(Exception(), SmartDeviceException, "Unable to query the device: "),
|
||||
(Exception(), KasaException, "Unable to query the device: "),
|
||||
(
|
||||
aiohttp.ServerFingerprintMismatch("exp", "got", "host", 1),
|
||||
SmartDeviceException,
|
||||
KasaException,
|
||||
"Unable to query the device: ",
|
||||
),
|
||||
],
|
||||
|
Reference in New Issue
Block a user