mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-09 20:24: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:
@@ -4,7 +4,7 @@ from abc import ABC, abstractmethod
|
||||
from typing import Dict
|
||||
|
||||
from .device import Device
|
||||
from .exceptions import SmartDeviceException
|
||||
from .exceptions import KasaException
|
||||
from .feature import Feature
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@@ -39,7 +39,7 @@ class Module(ABC):
|
||||
"""Add module feature."""
|
||||
feat_name = f"{self._module}_{feature.name}"
|
||||
if feat_name in self._module_features:
|
||||
raise SmartDeviceException("Duplicate name detected %s" % feat_name)
|
||||
raise KasaException("Duplicate name detected %s" % feat_name)
|
||||
self._module_features[feat_name] = feature
|
||||
|
||||
def __repr__(self) -> str:
|
||||
|
Reference in New Issue
Block a user