Skip to main content

rypipe_core/
error.rs

1use thiserror::Error;
2
3/// Crate-wide error type.
4#[derive(Debug, Error)]
5pub enum Error {
6    /// Invalid UTF-8 in input bytes.
7    #[error("invalid UTF-8: {0}")]
8    Utf8(#[from] simdutf8::basic::Utf8Error),
9
10    /// I/O failure (read, seek, mmap, etc.).
11    #[error("I/O error: {0}")]
12    Io(#[from] std::io::Error),
13
14    /// Invalid or inconsistent execution plan.
15    #[error("plan error: {0}")]
16    Plan(String),
17
18    /// A strict executor memory allowance was exceeded.
19    #[error("memory budget exceeded: {used} bytes used, limit {limit} bytes")]
20    Memory { used: usize, limit: usize },
21
22    /// Merge conflict between chunks (e.g. column type mismatch).
23    #[error("merge error: {0}")]
24    Merge(String),
25
26    /// Arrow array/batch construction failure.
27    #[error("Arrow error: {0}")]
28    Arrow(#[from] arrow::error::ArrowError),
29
30    /// Parser misbehavior: the parser returned invalid data.
31    #[error("parser error: {0}")]
32    Parser(String),
33
34    /// Lifetime violation: the parser returned a borrowed value that outlives the input.
35    #[error("lifetime error: {0}")]
36    Lifetime(String),
37}
38
39/// Shorthand result type used throughout the crate.
40pub type Result<T> = std::result::Result<T, Error>;