Skip to main content

objectiveai_sdk/functions/expression/
error.rs

1//! Errors that can occur during expression compilation.
2
3/// Errors that can occur when compiling expressions.
4#[derive(Debug, thiserror::Error)]
5pub enum ExpressionError {
6    /// The JMESPath expression is invalid or failed to evaluate.
7    #[error(transparent)]
8    JmespathError(#[from] jmespath::JmespathError),
9    /// The Starlark expression failed to parse.
10    #[error("starlark parse error: {0}")]
11    StarlarkParseError(String),
12    /// The Starlark expression failed to evaluate.
13    #[error("starlark evaluation error: {0}")]
14    StarlarkEvalError(String),
15    /// The Starlark result could not be converted to JSON.
16    #[error("starlark conversion error: {0}")]
17    StarlarkConversionError(String),
18    /// The expression result could not be deserialized to the expected type.
19    #[error(transparent)]
20    DeserializationError(#[from] serde_json::Error),
21    /// Expected a single value but the expression returned multiple.
22    #[error("expected one value, found many")]
23    ExpectedOneValueFoundMany,
24    /// A Special expression variant is not supported for this target type.
25    #[error("unsupported special expression")]
26    UnsupportedSpecial,
27}