Skip to content

Commit

Permalink
All device specific exceptions derives from DeviceException now.
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed Jan 24, 2018
1 parent 9202f1d commit 7626673
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions miio/airpurifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import enum
from typing import Any, Dict, Optional
from collections import defaultdict
from .device import Device
from .device import Device, DeviceException

_LOGGER = logging.getLogger(__name__)


class AirPurifierException(Exception):
class AirPurifierException(DeviceException):
pass


Expand Down
4 changes: 2 additions & 2 deletions miio/ceil.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import logging
from .device import Device
from typing import Any, Dict
from collections import defaultdict
from .device import Device, DeviceException

_LOGGER = logging.getLogger(__name__)


class CeilException(Exception):
class CeilException(DeviceException):
pass


Expand Down
6 changes: 5 additions & 1 deletion miio/chuangmi_ir.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from .device import Device, DeviceException


class ChuangmiIrException(DeviceException):
pass


class ChuangmiIr(Device):
"""Main class representing Chuangmi IR Remote Controller."""

Expand All @@ -10,7 +14,7 @@ def learn(self, key: int):
:param int key: Storage slot, must be between 1 and 1000000"""

if key < 1 or key > 1000000:
raise DeviceException("Invalid parameter FIXME wrong exception")
raise ChuangmiIrException("Invalid storage slot.")
return self.send("miIO.ir_learn", {'key': str(key)})

def read(self, key: int):
Expand Down
4 changes: 2 additions & 2 deletions miio/philips_bulb.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import logging
from .device import Device
from typing import Any, Dict
from collections import defaultdict
from .device import Device, DeviceException

_LOGGER = logging.getLogger(__name__)


class PhilipsBulbException(Exception):
class PhilipsBulbException(DeviceException):
pass


Expand Down
4 changes: 2 additions & 2 deletions miio/philips_eyecare.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import logging
from .device import Device
from typing import Any, Dict
from collections import defaultdict
from .device import Device, DeviceException

_LOGGER = logging.getLogger(__name__)


class PhilipsEyecareException(Exception):
class PhilipsEyecareException(DeviceException):
pass


Expand Down
4 changes: 2 additions & 2 deletions miio/yeelight.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from .device import Device
from typing import Tuple, Optional
from enum import IntEnum
import warnings
from .device import Device, DeviceException


class YeelightException(Exception):
class YeelightException(DeviceException):
pass


Expand Down

0 comments on commit 7626673

Please sign in to comment.