Skip to main content
Version: v2.0

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)

[view_source]

Base exception for all v2 errors.

__init__

def __init__(message: Union[str, List[str]],
details: Optional[Dict[str, Any]] = None) -> None

[view_source]

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)

[view_source]

Raised when resource operations fail.

APIError Objects

class APIError(AixplainV2Error)

[view_source]

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,
retryable: Optional[bool] = None) -> None

[view_source]

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.
  • retryable - Explicit retry signal, tri-state. None (the default) means "no opinion" — callers fall back to the status-code heuristic, where 0 stands for "no HTTP response at all". False marks a deterministic failure that re-submitting cannot fix; a business FAILED response is the motivating case, because its usually-absent statusCode collapses onto that same 0 transport sentinel.

AixplainIssueError Objects

class AixplainIssueError(APIError)

[view_source]

Raised when SDK issue reporting fails.

ValidationError Objects

class ValidationError(AixplainV2Error)

[view_source]

Raised when validation fails.

TimeoutError Objects

class TimeoutError(AixplainV2Error)

[view_source]

Raised when operations timeout.

FileUploadError Objects

class FileUploadError(AixplainV2Error)

[view_source]

Raised when file upload operations fail.

UntrustedURLError Objects

class UntrustedURLError(AixplainV2Error)

[view_source]

Raised when a credentialed request targets a host outside the trusted set.

Not an APIError: no request is made, so there is no status code to report. Poll URLs come from response bodies, so this is the SDK refusing to hand the team API key to a host a body asked it to talk to.

create_operation_failed_error

def create_operation_failed_error(response: Dict[str, Any]) -> APIError

[view_source]

Create an operation failed error from API response.

The error is always marked non-retryable: a FAILED body reports a business outcome, and its statusCode (usually absent, hence 0) is not a transport code. Without the explicit flag it would be indistinguishable from a connection failure and re-POSTed, billing the customer again for the same deterministic failure (BUG-1090).