summaryrefslogtreecommitdiffstats
path: root/freestyle_hid/_exceptions.py
blob: aa71e7c70ee3441aced9c7315a7b18497bbf4264 (plain) (blame)
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
33
34
35
36
37
# SPDX-FileCopyrightText: © 2020 The freestyle-hid Authors
# SPDX-License-Identifier: Apache-2.0


class HIDError(Exception):
    """Errors related to the HID access process."""


class ConnectionError(Exception):
    """Errors related to Session establishment."""


class EncryptionHandshakeError(ConnectionError):
    """Errors related to encryption handshake."""


class ChecksumError(Exception):
    """Errors related to the transmission checksums."""


class CommandError(Exception):
    """Errors related to the command stream."""


class EncryptionNotInitialized(CommandError):
    """Device needs encryption handshake."""


class MissingFreeStyleKeys(Exception):
    """The freestyle-hid-keys package is missing."""

    def __init__(self):
        super().__init__(
            "The freestyle-hid-keys package is missing, please install it from PyPi."
            " You can install freestyle-hid[encryption] to select the encryption keys"
            " package as an extra dependency."
        )