sail / sail_scripts /kernel /src /errors.rs
muterornament's picture
Industrialize: Backup sovereign training pipeline and native kernel
0f6a233 verified
Raw
History Blame Contribute Delete
762 Bytes
//! SAIL Kernel Error Types
//!
//! Centralized, typed errors for all kernel operations.
//! Uses `thiserror` for ergonomic, zero-cost error handling with no `unwrap`.
use thiserror::Error;
/// All possible errors in the SAIL kernel
#[derive(Error, Debug)]
pub enum KernelError {
#[error("I/O error: {0}")]
IoError(String),
#[error("Arrow write error: {0}")]
ArrowError(String),
#[error("Compression error: {0}")]
CompressionError(String),
#[error("Tokenizer error: {0}")]
TokenizerError(String),
#[error("Invalid input: {0}")]
InvalidInput(String),
}
impl From<KernelError> for pyo3::PyErr {
fn from(err: KernelError) -> pyo3::PyErr {
pyo3::exceptions::PyRuntimeError::new_err(err.to_string())
}
}