Struct jmespath_community::errors::Error
source · pub struct Error {
pub kind: Kind,
pub message: String,
pub position: Option<Position>,
}
Expand description
The error type for this crate.
Fields§
§kind: Kind
One of the valid error Kind
values.
message: String
A message indicating the root cause for the error.
position: Option<Position>
The position within a JMESPath expression.
Implementations§
source§impl Error
impl Error
sourcepub fn too_few_arguments(
function_name: &str,
min_count: usize,
count: usize,
is_variadic: bool
) -> Error
pub fn too_few_arguments( function_name: &str, min_count: usize, count: usize, is_variadic: bool ) -> Error
Raises a runtime error when not enough arguments are supplied to a JMESPath Function.
sourcepub fn too_many_arguments(
function_name: &str,
max_count: usize,
count: usize
) -> Error
pub fn too_many_arguments( function_name: &str, max_count: usize, count: usize ) -> Error
Raises a runtime error when more arguments are supplied than expected by a JMESPath Function.
sourcepub fn undefined_variable(variable_name: &str) -> Error
pub fn undefined_variable(variable_name: &str) -> Error
Raises a runtime error when an undefined variable is evaluated.
sourcepub fn unknown_function(function_name: &str) -> Error
pub fn unknown_function(function_name: &str) -> Error
Raises a runtime error when an unknown function is invoked.
Example
use jmespath_community as jmespath;
use jmespath::errors::Kind;
use jmespath::errors::Error;
let err = Error::unknown_function("unknown");
assert_eq!(Kind::UnknownFunction, err.kind);
assert_eq!("Error: unknown-function, the function 'unknown' does not exist", err.to_string());
Trait Implementations§
source§impl Error for Error
impl Error for Error
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
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()
source§impl From<ParseError<AST>> for Error
impl From<ParseError<AST>> for Error
source§fn from(error: ParseError<AST>) -> Self
fn from(error: ParseError<AST>) -> Self
Converts to this type from the input type.
source§impl Ord for Error
impl Ord for Error
source§impl PartialEq<Error> for Error
impl PartialEq<Error> for Error
source§impl PartialOrd<Error> for Error
impl PartialOrd<Error> for Error
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Error
Auto Trait Implementations§
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
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
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.