kizzasi_core/
error.rs

1//! Error types for kizzasi-core
2
3#[cfg(not(feature = "std"))]
4use alloc::string::String;
5
6use scirs2_core::ndarray::ShapeError;
7use thiserror::Error;
8
9/// Result type alias for core operations
10pub type CoreResult<T> = Result<T, CoreError>;
11
12/// Errors that can occur in the core SSM engine
13#[derive(Error, Debug)]
14pub enum CoreError {
15    #[error("Invalid configuration: {0}")]
16    InvalidConfig(String),
17
18    #[error("Dimension mismatch: expected {expected}, got {got}")]
19    DimensionMismatch { expected: usize, got: usize },
20
21    #[error("Model not initialized")]
22    NotInitialized,
23
24    #[error("Weight loading failed: {0}")]
25    WeightLoadError(String),
26
27    #[error("Inference error: {0}")]
28    InferenceError(String),
29
30    #[error("Training error: {0}")]
31    TrainingError(String),
32
33    #[error("Device error: {0}")]
34    DeviceError(String),
35
36    #[error("{0}")]
37    Generic(String),
38
39    #[error("Candle error: {0}")]
40    CandleError(#[from] candle_core::Error),
41
42    #[error("Shape error: {0}")]
43    ShapeError(#[from] ShapeError),
44}