#[non_exhaustive]pub enum ExpressionErrorKind {
Show 14 variants
UndefinedVariable {
name: String,
suggestion: String,
},
UnknownFunction {
name: String,
},
TypeError {
message: String,
},
IntegerOverflow,
DivisionByZero {
op: &'static str,
},
FloatError {
message: String,
},
IndexOutOfBounds {
message: String,
},
MemoryLimitExceeded {
used: usize,
limit: usize,
},
OperationLimitExceeded {
count: usize,
limit: usize,
},
ExpressionTooDeep {
depth: usize,
limit: usize,
},
UnsupportedSyntax {
feature: String,
},
ExplicitFail(String),
ParseError(String),
Other(String),
}Expand description
Structured error kinds for expression evaluation.
Callers can match on specific variants to handle errors programmatically without parsing error message strings.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UndefinedVariable
A referenced variable was not found in any symbol table.
UnknownFunction
A referenced function was not found in the function library.
TypeError
Argument types did not match any overload signature.
IntegerOverflow
An integer operation overflowed the 64-bit signed range.
DivisionByZero
Division or modulo by zero.
FloatError
A float operation produced infinity or NaN.
IndexOutOfBounds
An index was out of bounds for a list, string, or range expression.
MemoryLimitExceeded
Expression memory usage exceeded the configured limit.
OperationLimitExceeded
Expression operation count exceeded the configured limit.
ExpressionTooDeep
Expression AST nesting depth exceeded the configured limit.
Raised by the parser’s structural validator and by the evaluator to
prevent stack exhaustion on pathological inputs such as
((((...1...)))) or a ~1000-term left-associative binop chain.
The limit is MAX_EXPRESSION_DEPTH.
UnsupportedSyntax
A Python syntax feature that is not supported in the expression language.
ExplicitFail(String)
The fail() function was called explicitly.
ParseError(String)
A parse error from the underlying Python parser.
Other(String)
Any other error that doesn’t fit a structured variant.
Trait Implementations§
Source§impl Clone for ExpressionErrorKind
impl Clone for ExpressionErrorKind
Source§fn clone(&self) -> ExpressionErrorKind
fn clone(&self) -> ExpressionErrorKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ExpressionErrorKind
impl Debug for ExpressionErrorKind
Source§impl Display for ExpressionErrorKind
impl Display for ExpressionErrorKind
Source§impl Error for ExpressionErrorKind
impl Error for ExpressionErrorKind
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for ExpressionErrorKind
impl RefUnwindSafe for ExpressionErrorKind
impl Send for ExpressionErrorKind
impl Sync for ExpressionErrorKind
impl Unpin for ExpressionErrorKind
impl UnsafeUnpin for ExpressionErrorKind
impl UnwindSafe for ExpressionErrorKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more