Skip to main content

laddu_compile/
error.rs

1use laddu_expr::{ExprGraphError, parameters::ParamError};
2use laddu_kernel::KernelIrError;
3use thiserror::Error;
4
5/// Result type for compilation and optimization operations.
6pub type CompileResult<T> = Result<T, CompileError>;
7
8/// Errors produced while analyzing or compiling an expression graph.
9#[derive(Clone, Debug, Error, PartialEq)]
10pub enum CompileError {
11    /// Parameter collection or validation failed.
12    #[error(transparent)]
13    Params(#[from] ParamError),
14    /// Expression graph validation failed.
15    #[error(transparent)]
16    Graph(#[from] ExprGraphError),
17    /// Kernel IR construction or validation failed.
18    #[error(transparent)]
19    Kernel(#[from] KernelIrError),
20    /// The lowered executable plan was internally inconsistent.
21    #[error("invalid executable plan: {0}")]
22    InvalidExecutablePlan(String),
23    /// The requested compilation feature is not supported.
24    #[error("unsupported compile feature: {0}")]
25    Unsupported(&'static str),
26}