Skip to content

Exceptions

influxdb.exceptions

Exception handler for InfluxDBClient.

Classes

InfluxDBClientError

Bases: Exception

Raised when an error occurs in the request.

Source code in influxdb/exceptions.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class InfluxDBClientError(Exception):
    """Raised when an error occurs in the request."""

    def __init__(self, content, code=None):
        """Initialize the InfluxDBClientError.

        Args:
            content (str or bytes): the error message content
            code (int): optional error code

        """
        if isinstance(content, type(b"")):
            content = content.decode("UTF-8", "replace")

        if code is not None:
            message = "%s: %s" % (code, content)
        else:
            message = content

        super(InfluxDBClientError, self).__init__(message)
        self.content = content
        self.code = code
Functions
__init__(content, code=None)

Initialize the InfluxDBClientError.

Parameters:

Name Type Description Default
content str or bytes

the error message content

required
code int

optional error code

None
Source code in influxdb/exceptions.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
def __init__(self, content, code=None):
    """Initialize the InfluxDBClientError.

    Args:
        content (str or bytes): the error message content
        code (int): optional error code

    """
    if isinstance(content, type(b"")):
        content = content.decode("UTF-8", "replace")

    if code is not None:
        message = "%s: %s" % (code, content)
    else:
        message = content

    super(InfluxDBClientError, self).__init__(message)
    self.content = content
    self.code = code

InfluxDBServerError

Bases: Exception

Raised when a server error occurs.

Source code in influxdb/exceptions.py
34
35
36
37
38
39
40
41
42
43
44
class InfluxDBServerError(Exception):
    """Raised when a server error occurs."""

    def __init__(self, content):
        """Initialize the InfluxDBServerError.

        Args:
            content (str): the error message content

        """
        super(InfluxDBServerError, self).__init__(content)
Functions
__init__(content)

Initialize the InfluxDBServerError.

Parameters:

Name Type Description Default
content str

the error message content

required
Source code in influxdb/exceptions.py
37
38
39
40
41
42
43
44
def __init__(self, content):
    """Initialize the InfluxDBServerError.

    Args:
        content (str): the error message content

    """
    super(InfluxDBServerError, self).__init__(content)