exceptions
konigle.exceptions
¶
Custom exception hierarchy for structured error handling in the Konigle SDK.
This module defines a comprehensive set of exceptions that map to specific HTTP status codes and error conditions, providing clear context for error handling in client applications.
APIError
¶
Bases: KonigleError
Base class for API-related errors with structured information.
| PARAMETER | DESCRIPTION |
|---|---|
message
|
Human-readable error message
TYPE:
|
status_code
|
HTTP status code from the API response
TYPE:
|
response
|
Full response data from the API
TYPE:
|
__str__()
¶
Enhanced string representation with context.
AuthenticationError
¶
Bases: APIError
Invalid API key or authentication failure (HTTP 401).
This error indicates that the provided API key is invalid, expired, or missing from the request.
AuthorizationError
¶
Bases: APIError
Insufficient permissions for the requested operation (HTTP 403).
The API key is valid but doesn't have permission to perform the requested action on the specified resource.
ConflictError
¶
Bases: APIError
Resource conflict (HTTP 409).
The request conflicts with the current state of the resource. Common causes include duplicate unique values or concurrent modifications.
KonigleError
¶
Bases: Exception
Base exception for all SDK errors.
All Konigle SDK exceptions inherit from this base class, making it easy to catch any SDK-related error.
KonigleTimeoutError
¶
NetworkError
¶
Bases: KonigleError
Network connectivity issues.
This error is raised when network-level problems prevent communication with the API server.
NotFoundError
¶
Bases: APIError
Resource not found (HTTP 404).
The requested resource does not exist or has been deleted.
RateLimitError
¶
Bases: APIError
Rate limit exceeded (HTTP 429).
Too many requests have been made in a short time period.
| PARAMETER | DESCRIPTION |
|---|---|
message
|
Rate limit error message
TYPE:
|
retry_after
|
Number of seconds to wait before retrying
TYPE:
|
**kwargs
|
Additional arguments passed to APIError
DEFAULT:
|
__str__()
¶
Enhanced representation including retry timing.
ServerError
¶
Bases: APIError
Server-side errors (HTTP 5xx).
An error occurred on the server side. These errors are typically temporary and may be resolved by retrying the request.
ValidationError
¶
Bases: APIError
Request validation failed (HTTP 400).
This error includes detailed information about which fields failed validation and why.
| PARAMETER | DESCRIPTION |
|---|---|
message
|
General validation error message
TYPE:
|
field_errors
|
Dictionary mapping field names to error messages
TYPE:
|
**kwargs
|
Additional arguments passed to APIError
DEFAULT:
|
__str__()
¶
Enhanced representation including field-specific errors.
map_http_error(status_code, message, response_data=None)
¶
Map HTTP status codes to appropriate exception classes.
| PARAMETER | DESCRIPTION |
|---|---|
status_code
|
HTTP status code from the response
TYPE:
|
message
|
Error message from the API or generated
TYPE:
|
response_data
|
Full response data from the API
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
APIError
|
Appropriate APIError subclass instance |