File: exception.py

package info (click to toggle)
zigpy-deconz 0.25.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 360 kB
  • sloc: python: 3,911; makefile: 5
file content (32 lines) | stat: -rw-r--r-- 811 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""Zigpy-deconz exceptions."""

from __future__ import annotations

import typing

from zigpy.exceptions import APIException

if typing.TYPE_CHECKING:
    from zigpy_deconz.api import Command, CommandId, Status


class CommandError(APIException):
    def __init__(self, *args, status: Status, command: Command, **kwargs):
        """Initialize instance."""
        super().__init__(*args, **kwargs)
        self.command = command
        self.status = status


class ParsingError(CommandError):
    pass


class MismatchedResponseError(APIException):
    def __init__(
        self, command_id: CommandId, params: dict[str, typing.Any], *args, **kwargs
    ) -> None:
        """Initialize instance."""
        super().__init__(*args, **kwargs)
        self.command_id = command_id
        self.params = params