File: exceptions.py

package info (click to toggle)
tesla-wall-connector 1.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 236 kB
  • sloc: python: 550; makefile: 7; sh: 5
file content (30 lines) | stat: -rw-r--r-- 864 bytes parent folder | download
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
""" Tesla Wall Connector Exceptions """


class WallConnectorError(Exception):
    """Generic WallConnector exception."""


class WallConnectorDecodeError(WallConnectorError):
    """WallConnector exception thrown when decoding a response fails."""

    def __init__(self, message, raw_body):
        """Init Decode error."""
        super().__init__(message)
        self.raw_body = raw_body

    def get_raw_body(self) -> str:
        """Return the raw body of the failing request."""
        return self.raw_body


class WallConnectorEmptyResponseError(WallConnectorError):
    """WallConnector empty API response exception."""


class WallConnectorConnectionError(WallConnectorError):
    """WallConnector connection exception."""


class WallConnectorConnectionTimeoutError(WallConnectorConnectionError):
    """WallConnector connection Timeout exception."""