Exceptions¶
Custom exception classes for error handling.
Base Exception¶
pycentral_error
¶
PycentralError(*args)
¶
Bases: Exception
Base exception class for all pycentral-specific errors.
This exception serves as the base class for all custom exceptions in the pycentral library. It provides common functionality for error handling and message formatting.
Attributes:
| Name | Type | Description |
|---|---|---|
base_msg |
str
|
The base error message for this exception type. |
message |
str
|
The complete formatted error message. |
response |
dict
|
The API response associated with the error, if applicable. |
Example
Source code in pycentral/exceptions/pycentral_error.py
Login Error¶
login_error
¶
LoginError(message, status_code=None, *details)
¶
Bases: PycentralError
Exception raised when login or authentication fails.
This exception is raised when authentication to Central fails, typically due to invalid credentials, expired tokens, or network issues.
Attributes:
| Name | Type | Description |
|---|---|---|
base_msg |
str
|
The base error message for this exception type. |
message |
str
|
Detailed error message describing the login failure. |
status_code |
int
|
HTTP status code associated with the login failure, if available. |
Example
Source code in pycentral/exceptions/login_error.py
Response Error¶
response_error
¶
ResponseError(*args)
¶
Bases: PycentralError
Exception raised when an API response indicates an error.
This exception is raised when the API returns an error response, such as HTTP error codes (4xx, 5xx) or when the response content indicates a failure.
Attributes:
| Name | Type | Description |
|---|---|---|
base_msg |
str
|
The base error message for this exception type. |
message |
str
|
Detailed error message describing the response failure. |
response |
dict
|
The API response object containing error details. |
Example
Source code in pycentral/exceptions/response_error.py
Parameter Error¶
parameter_error
¶
ParameterError(*args)
¶
Bases: VerificationError
Exception raised when invalid parameters are passed to functions.
This exception is a subclass of VerificationError and is used to indicate that one or more parameters provided to a function are invalid, missing, or do not meet the required constraints.
Attributes:
| Name | Type | Description |
|---|---|---|
base_msg |
str
|
The base error message for this exception type. |
Example
Source code in pycentral/exceptions/verification_error.py
Verification Error¶
verification_error
¶
VerificationError(*args)
¶
Bases: PycentralError
Exception raised when verification checks fail during pycentral operations.
This exception is raised when verification checks of values fail prior to API execution. It serves as a base class for more specific verification-related exceptions.
Attributes:
| Name | Type | Description |
|---|---|---|
base_msg |
str
|
The base error message for this exception type. |
message |
str
|
Detailed error message describing the verification failure. |
module |
str
|
The module or context where the verification error occurred. |