mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-06 10:44:04 +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:
@@ -2,7 +2,7 @@
|
||||
from enum import Enum
|
||||
from typing import Optional
|
||||
|
||||
from ...exceptions import SmartDeviceException
|
||||
from ...exceptions import KasaException
|
||||
from ..iotmodule import IotModule
|
||||
|
||||
|
||||
@@ -54,9 +54,7 @@ class Motion(IotModule):
|
||||
elif range is not None:
|
||||
payload = {"index": range.value}
|
||||
else:
|
||||
raise SmartDeviceException(
|
||||
"Either range or custom_range need to be defined"
|
||||
)
|
||||
raise KasaException("Either range or custom_range need to be defined")
|
||||
|
||||
return await self.call("set_trigger_sens", payload)
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
"""Provides the current time and timezone information."""
|
||||
from datetime import datetime
|
||||
|
||||
from ...exceptions import SmartDeviceException
|
||||
from ...exceptions import KasaException
|
||||
from ..iotmodule import IotModule, merge
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class Time(IotModule):
|
||||
res["min"],
|
||||
res["sec"],
|
||||
)
|
||||
except SmartDeviceException:
|
||||
except KasaException:
|
||||
return None
|
||||
|
||||
async def get_timezone(self):
|
||||
|
Reference in New Issue
Block a user