pub struct EvalError {
pub message: String,
pub kind: EvalErrorKind,
}Expand description
An error that occurred during CEL evaluation.
Fields§
§message: StringThe error message.
kind: EvalErrorKindThe kind of error.
Implementations§
Source§impl EvalError
impl EvalError
Sourcepub fn new(kind: EvalErrorKind, message: impl Into<String>) -> Self
pub fn new(kind: EvalErrorKind, message: impl Into<String>) -> Self
Create a new error with the given kind and message.
Sourcepub fn division_by_zero() -> Self
pub fn division_by_zero() -> Self
Create a division by zero error.
Sourcepub fn modulo_by_zero() -> Self
pub fn modulo_by_zero() -> Self
Create a modulo by zero error.
Sourcepub fn range_error(message: impl Into<String>) -> Self
pub fn range_error(message: impl Into<String>) -> Self
Create a range error (value out of valid range).
Sourcepub fn type_mismatch(expected: &str, actual: &str) -> Self
pub fn type_mismatch(expected: &str, actual: &str) -> Self
Create a type mismatch error.
Sourcepub fn unknown_identifier(name: &str) -> Self
pub fn unknown_identifier(name: &str) -> Self
Create an unknown identifier error.
Sourcepub fn unknown_function(name: &str) -> Self
pub fn unknown_function(name: &str) -> Self
Create an unknown function error.
Sourcepub fn index_out_of_bounds(index: i64, len: usize) -> Self
pub fn index_out_of_bounds(index: i64, len: usize) -> Self
Create an index out of bounds error.
Sourcepub fn key_not_found(key: &str) -> Self
pub fn key_not_found(key: &str) -> Self
Create a key not found error.
Sourcepub fn invalid_argument(message: impl Into<String>) -> Self
pub fn invalid_argument(message: impl Into<String>) -> Self
Create an invalid argument error.
Sourcepub fn no_matching_overload(func: &str) -> Self
pub fn no_matching_overload(func: &str) -> Self
Create a no matching overload error.
Sourcepub fn field_not_found(field: &str) -> Self
pub fn field_not_found(field: &str) -> Self
Create a field not found error.
Sourcepub fn invalid_conversion(from: &str, to: &str) -> Self
pub fn invalid_conversion(from: &str, to: &str) -> Self
Create an invalid conversion error.
Trait Implementations§
Source§impl Error for EvalError
impl Error for EvalError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for EvalError
impl RefUnwindSafe for EvalError
impl Send for EvalError
impl Sync for EvalError
impl Unpin for EvalError
impl UnsafeUnpin for EvalError
impl UnwindSafe for EvalError
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
Mutably borrows from an owned value. Read more