Failed upload
FailedUpload
dataclass
#
FailedUpload(
item: T,
error_message: str,
error_type: str,
timestamp: Optional[datetime] = now(),
exception: Optional[Exception] = None,
trace_id: Optional[str] = None,
stage: Optional[str] = None,
http_status: Optional[int] = None,
)
Bases: Generic[T]
Represents a failed upload with the item and error details.
Attributes:
| Name | Type | Description |
|---|---|---|
item |
T
|
The item that failed to upload. |
error_message |
str
|
The error message describing the failure reason. |
error_type |
str
|
The type of the exception (e.g., "RapidataError"). |
timestamp |
Optional[datetime]
|
Optional timestamp when the failure occurred. |
exception |
Optional[Exception]
|
Optional original exception for richer error context. |
trace_id |
Optional[str]
|
Optional backend trace ID, when the failure originated from a
RapidataError whose response carried one — either as a |
stage |
Optional[str]
|
Optional ingestion stage that failed, for remote-URL assets (e.g. "download", "content_type", "timeout", "size", "internal"). Only "internal" indicates a Rapidata-side fault; every other stage is caller-actionable. |
http_status |
Optional[int]
|
Optional origin-server HTTP status, when the failure was an HTTP response from the asset host (e.g. a 403 on the URL). Distinct from any status of the Rapidata API call itself. |
from_exception
classmethod
#
from_exception(
item: T, exception: Exception | None
) -> FailedUpload[T]
Create a FailedUpload from an item and exception.
For RapidataError exceptions, extracts the clean API error reason, the backend trace ID, and the structured ingestion stage / origin HTTP status (when present in the error response). For other exceptions, uses the string representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
item
|
T
|
The item that failed to upload. |
required |
exception
|
Exception | None
|
The exception that occurred. |
required |
Returns:
| Type | Description |
|---|---|
FailedUpload[T]
|
FailedUpload instance with error details extracted from the exception. |
Source code in src/rapidata/rapidata_client/exceptions/failed_upload.py
format_error_details #
Format error details for logging or display.
Returns:
| Type | Description |
|---|---|
str
|
Formatted string with all error details including timestamp. |