Skip to main content

Module error

Module error 

Source
Expand description

Unified error types for the rust-ai ecosystem.

This module provides common error types that are shared across all rust-ai crates. Each crate can extend these with domain-specific variants while maintaining compatibility for error conversion.

§Error Hierarchy

CoreError
├── InvalidConfig       - Configuration validation failures
├── ShapeMismatch       - Tensor shape incompatibilities
├── DimensionMismatch   - Dimension count mismatches
├── DeviceNotAvailable  - Requested device unavailable
├── DeviceMismatch      - Tensors on different devices
├── OutOfMemory         - GPU/CPU memory exhausted
├── KernelError         - GPU kernel launch/execution failure
├── NotImplemented      - Feature not yet implemented
├── Io                  - File/network I/O errors
└── Candle              - Underlying Candle errors

§Crate-Specific Errors

Crates should define their own error types that wrap CoreError:

use rust_ai_core::CoreError;
use thiserror::Error;

#[derive(Error, Debug)]
pub enum MyError {
    #[error("adapter not found: {0}")]
    AdapterNotFound(String),
     
    #[error(transparent)]
    Core(#[from] CoreError),
}

Enums§

CoreError
Core errors shared across the rust-ai ecosystem.

Type Aliases§

Result
Result type alias for rust-ai-core operations.