Implementation:Eventual Inc Daft Exceptions
| Knowledge Sources | |
|---|---|
| Domains | Error_Handling, FFI |
| Last Updated | 2026-02-08 14:00 GMT |
Overview
Concrete tool for defining the core exception hierarchy used at the Rust-to-Python boundary for classifying and propagating errors.
Description
The exceptions module defines the exception class hierarchy that the Rust engine raises into Python via PyO3. The base class DaftCoreException extends `ValueError`. Below it, DaftTypeError covers type-related errors, and DaftTransientError covers retryable network/IO errors. The transient error branch further specializes into ConnectTimeoutError, ReadTimeoutError, ByteStreamError, SocketError, ThrottleError, and MiscTransientError. These classes are referenced from `src/common/error/src/python.rs` and must not be renamed or deleted without updating the Rust side.
Usage
Catch these exceptions when handling errors from Daft operations. Use `DaftTransientError` and its subclasses to implement retry logic for network-related failures. Use `DaftTypeError` to catch type validation errors from the Rust engine.
Code Reference
Source Location
- Repository: Eventual_Inc_Daft
- File: daft/exceptions.py
- Lines: 1-78
Signature
class DaftCoreException(ValueError):
"""DaftCore Base Exception."""
class DaftTypeError(DaftCoreException):
"""Type Error that occurred in Daft Core."""
class DaftTransientError(DaftCoreException):
"""Daft Transient Error — retryable network/IO errors."""
class ConnectTimeoutError(DaftTransientError):
"""Connection timeout."""
class ReadTimeoutError(DaftTransientError):
"""Read timeout."""
class ByteStreamError(DaftTransientError):
"""Byte stream read error."""
class SocketError(DaftTransientError):
"""Socket error."""
class ThrottleError(DaftTransientError):
"""Throttle/rate-limit error."""
class MiscTransientError(DaftTransientError):
"""Miscellaneous transient error."""
Import
from daft.exceptions import (
DaftCoreException,
DaftTypeError,
DaftTransientError,
ConnectTimeoutError,
ReadTimeoutError,
ThrottleError,
)
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | Exception classes are instantiated by the Rust engine via PyO3 |
Outputs
| Name | Type | Description |
|---|---|---|
| Exception instances | DaftCoreException subclasses | Raised into Python when Rust operations fail |
Usage Examples
Retry on Transient Errors
import daft
from daft.exceptions import DaftTransientError
for attempt in range(3):
try:
df = daft.read_parquet("s3://bucket/data.parquet").collect()
break
except DaftTransientError as e:
print(f"Transient error (attempt {attempt + 1}): {e}")
if attempt == 2:
raise