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:
Steven B
2024-02-21 15:52:55 +00:00
committed by GitHub
parent 4beff228c9
commit 8c39e81a40
44 changed files with 393 additions and 361 deletions

View File

@@ -8,7 +8,7 @@ from kasa.credentials import Credentials
from kasa.deviceconfig import (
DeviceConfig,
)
from kasa.exceptions import SmartDeviceException
from kasa.exceptions import KasaException
async def test_serialization():
@@ -29,7 +29,7 @@ async def test_serialization():
ids=["invalid-dict", "not-dict"],
)
def test_deserialization_errors(input_value, expected_msg):
with pytest.raises(SmartDeviceException, match=expected_msg):
with pytest.raises(KasaException, match=expected_msg):
DeviceConfig.from_dict(input_value)