aixplain.v2.exceptions
Unified error hierarchy for v2 system.
This module provides a comprehensive set of error types for consistent error handling across all v2 components.
AixplainV2Error Objects
class AixplainV2Error(Exception)
Base exception for all v2 errors.
__init__
def __init__(message: Union[str, List[str]],
details: Optional[Dict[str, Any]] = None) -> None
Initialize the exception with a message and optional details.
Arguments:
message- Error message string or list of error messages.details- Optional dictionary with additional error details.
ResourceError Objects
class ResourceError(AixplainV2Error)
Raised when resource operations fail.
APIError Objects
class APIError(AixplainV2Error)
Raised when API calls fail.
__init__
def __init__(message: Union[str, List[str]],
status_code: int = 0,
response_data: Optional[Dict[str, Any]] = None,
error: Optional[str] = None) -> None
Initialize APIError with HTTP status and response details.
Arguments:
message- Error message string or list of error messages.status_code- HTTP status code from the API response.response_data- Optional dictionary containing the raw API response.error- Optional error string override.
ValidationError Objects
class ValidationError(AixplainV2Error)
Raised when validation fails.
TimeoutError Objects
class TimeoutError(AixplainV2Error)
Raised when operations timeout.
FileUploadError Objects
class FileUploadError(AixplainV2Error)
Raised when file upload operations fail.
create_operation_failed_error
def create_operation_failed_error(response: Dict[str, Any]) -> APIError
Create an operation failed error from API response.