pydexcom.errors

Errors used in pydexcom.

 1"""Errors used in `pydexcom`."""
 2
 3
 4from enum import Enum
 5
 6
 7class DexcomErrorEnum(Enum):
 8    """Base class for all `pydexcom` error strings."""
 9
10    pass
11
12
13class AccountErrorEnum(DexcomErrorEnum):
14    """`AccountError` strings."""
15
16    ACCOUNT_NOT_FOUND = "Account not found"
17    PASSWORD_INVALID = "Password not valid"
18    MAX_ATTEMPTS = "Maximum authentication attempts exceeded"
19
20
21class SessionErrorEnum(DexcomErrorEnum):
22    """`SessionError` strings."""
23
24    NOT_FOUND = "Session ID not found"
25    INVALID = "Session not active or timed out"
26
27
28class ArgumentErrorEnum(DexcomErrorEnum):
29    """`ArgumentError` strings."""
30
31    MINUTES_INVALID = "Minutes must be and integer between 1 and 1440"
32    MAX_COUNT_INVALID = "Max count must be and integer between 1 and 288"
33    USERNAME_INVALID = "Username must be non-empty string"
34    PASSWORD_INVALID = "Password must be non-empty string"
35    ACCOUNT_ID_INVALID = "Account ID must be UUID"
36    ACCOUNT_ID_DEFAULT = "Account ID default"
37    SESSION_ID_INVALID = "Session ID must be UUID"
38    SESSION_ID_DEFAULT = "Session ID default"
39    GLUCOSE_READING_INVALID = "JSON glucose reading incorrectly formatted"
40
41
42class DexcomError(Exception):
43    """Base class for all `pydexcom` errors."""
44
45    def __init__(self, enum: DexcomErrorEnum):
46        """Create `DexcomError` from `DexcomErrorEnum`.
47
48        :param enum: associated `DexcomErrorEnum`
49        """
50        super().__init__(enum.value)
51        self._enum = enum
52
53    @property
54    def enum(self) -> DexcomErrorEnum:
55        """Get `DexcomErrorEnum` associated with error.
56
57        :return: `DexcomErrorEnum`"""
58        return self._enum
59
60
61class AccountError(DexcomError):
62    """Errors involving Dexcom Share API credentials."""
63
64    pass
65
66
67class SessionError(DexcomError):
68    """Errors involving Dexcom Share API session."""
69
70    pass
71
72
73class ArgumentError(DexcomError):
74    """Errors involving `pydexcom` arguments."""
75
76    pass
77    pass
class DexcomErrorEnum(enum.Enum):
 8class DexcomErrorEnum(Enum):
 9    """Base class for all `pydexcom` error strings."""
10
11    pass

Base class for all pydexcom error strings.

Inherited Members
enum.Enum
name
value
class AccountErrorEnum(DexcomErrorEnum):
14class AccountErrorEnum(DexcomErrorEnum):
15    """`AccountError` strings."""
16
17    ACCOUNT_NOT_FOUND = "Account not found"
18    PASSWORD_INVALID = "Password not valid"
19    MAX_ATTEMPTS = "Maximum authentication attempts exceeded"

AccountError strings.

ACCOUNT_NOT_FOUND = <AccountErrorEnum.ACCOUNT_NOT_FOUND: 'Account not found'>
PASSWORD_INVALID = <AccountErrorEnum.PASSWORD_INVALID: 'Password not valid'>
MAX_ATTEMPTS = <AccountErrorEnum.MAX_ATTEMPTS: 'Maximum authentication attempts exceeded'>
Inherited Members
enum.Enum
name
value
class SessionErrorEnum(DexcomErrorEnum):
22class SessionErrorEnum(DexcomErrorEnum):
23    """`SessionError` strings."""
24
25    NOT_FOUND = "Session ID not found"
26    INVALID = "Session not active or timed out"

SessionError strings.

NOT_FOUND = <SessionErrorEnum.NOT_FOUND: 'Session ID not found'>
INVALID = <SessionErrorEnum.INVALID: 'Session not active or timed out'>
Inherited Members
enum.Enum
name
value
class ArgumentErrorEnum(DexcomErrorEnum):
29class ArgumentErrorEnum(DexcomErrorEnum):
30    """`ArgumentError` strings."""
31
32    MINUTES_INVALID = "Minutes must be and integer between 1 and 1440"
33    MAX_COUNT_INVALID = "Max count must be and integer between 1 and 288"
34    USERNAME_INVALID = "Username must be non-empty string"
35    PASSWORD_INVALID = "Password must be non-empty string"
36    ACCOUNT_ID_INVALID = "Account ID must be UUID"
37    ACCOUNT_ID_DEFAULT = "Account ID default"
38    SESSION_ID_INVALID = "Session ID must be UUID"
39    SESSION_ID_DEFAULT = "Session ID default"
40    GLUCOSE_READING_INVALID = "JSON glucose reading incorrectly formatted"

ArgumentError strings.

MINUTES_INVALID = <ArgumentErrorEnum.MINUTES_INVALID: 'Minutes must be and integer between 1 and 1440'>
MAX_COUNT_INVALID = <ArgumentErrorEnum.MAX_COUNT_INVALID: 'Max count must be and integer between 1 and 288'>
USERNAME_INVALID = <ArgumentErrorEnum.USERNAME_INVALID: 'Username must be non-empty string'>
PASSWORD_INVALID = <ArgumentErrorEnum.PASSWORD_INVALID: 'Password must be non-empty string'>
ACCOUNT_ID_INVALID = <ArgumentErrorEnum.ACCOUNT_ID_INVALID: 'Account ID must be UUID'>
ACCOUNT_ID_DEFAULT = <ArgumentErrorEnum.ACCOUNT_ID_DEFAULT: 'Account ID default'>
SESSION_ID_INVALID = <ArgumentErrorEnum.SESSION_ID_INVALID: 'Session ID must be UUID'>
SESSION_ID_DEFAULT = <ArgumentErrorEnum.SESSION_ID_DEFAULT: 'Session ID default'>
GLUCOSE_READING_INVALID = <ArgumentErrorEnum.GLUCOSE_READING_INVALID: 'JSON glucose reading incorrectly formatted'>
Inherited Members
enum.Enum
name
value
class DexcomError(builtins.Exception):
43class DexcomError(Exception):
44    """Base class for all `pydexcom` errors."""
45
46    def __init__(self, enum: DexcomErrorEnum):
47        """Create `DexcomError` from `DexcomErrorEnum`.
48
49        :param enum: associated `DexcomErrorEnum`
50        """
51        super().__init__(enum.value)
52        self._enum = enum
53
54    @property
55    def enum(self) -> DexcomErrorEnum:
56        """Get `DexcomErrorEnum` associated with error.
57
58        :return: `DexcomErrorEnum`"""
59        return self._enum

Base class for all pydexcom errors.

DexcomError(enum: DexcomErrorEnum)
46    def __init__(self, enum: DexcomErrorEnum):
47        """Create `DexcomError` from `DexcomErrorEnum`.
48
49        :param enum: associated `DexcomErrorEnum`
50        """
51        super().__init__(enum.value)
52        self._enum = enum

Create DexcomError from DexcomErrorEnum.

Parameters

Get DexcomErrorEnum associated with error.

Returns

DexcomErrorEnum

Inherited Members
builtins.BaseException
with_traceback
add_note
args
class AccountError(DexcomError):
62class AccountError(DexcomError):
63    """Errors involving Dexcom Share API credentials."""
64
65    pass

Errors involving Dexcom Share API credentials.

Inherited Members
DexcomError
DexcomError
enum
builtins.BaseException
with_traceback
add_note
args
class SessionError(DexcomError):
68class SessionError(DexcomError):
69    """Errors involving Dexcom Share API session."""
70
71    pass

Errors involving Dexcom Share API session.

Inherited Members
DexcomError
DexcomError
enum
builtins.BaseException
with_traceback
add_note
args
class ArgumentError(DexcomError):
74class ArgumentError(DexcomError):
75    """Errors involving `pydexcom` arguments."""
76
77    pass
78    pass

Errors involving pydexcom arguments.

Inherited Members
DexcomError
DexcomError
enum
builtins.BaseException
with_traceback
add_note
args