Skip to main content

ronn_core/
error.rs

1// ! Error types for RONN core operations
2
3use thiserror::Error;
4
5/// Result type for core operations
6pub type Result<T> = std::result::Result<T, CoreError>;
7
8/// Core error types
9#[derive(Error, Debug)]
10pub enum CoreError {
11    /// Tensor operation failed
12    #[error("Tensor operation failed: {0}")]
13    TensorError(String),
14
15    /// Shape mismatch between tensors
16    #[error("Shape mismatch: {0}")]
17    ShapeMismatch(String),
18
19    /// Invalid operation attempted
20    #[error("Invalid operation: {0}")]
21    InvalidOperation(String),
22
23    /// Graph-related error
24    #[error("Graph error: {0}")]
25    GraphError(String),
26
27    /// Session-related error
28    #[error("Session error: {0}")]
29    SessionError(String),
30
31    /// Candle tensor library error
32    #[error("Candle error: {0}")]
33    CandleError(#[from] candle_core::Error),
34
35    /// IO error
36    #[error("IO error: {0}")]
37    IoError(#[from] std::io::Error),
38}