Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All device specific exceptions should derive from DeviceException #179

Merged
merged 1 commit into from
Jan 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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