From a5b8e8bc620912fdfeebcb473b3f221159b90586 Mon Sep 17 00:00:00 2001 From: Mike Taghavi Date: Sat, 11 Mar 2023 14:55:22 +0100 Subject: [PATCH] Implement error for jetro error type Fix issue with filter on non objects --- src/context.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/context.rs b/src/context.rs index e126947..400595b 100644 --- a/src/context.rs +++ b/src/context.rs @@ -251,6 +251,8 @@ impl fmt::Display for Error { } } +impl std::error::Error for Error {} + macro_rules! push_to_stack_or_produce { ($results:expr, $stack:expr, $tail:expr, $value:expr) => { let tlen = $tail.len(); @@ -362,7 +364,11 @@ macro_rules! do_comparision { impl FilterInner { fn eval(&self, entry: &Value) -> bool { - let obj = entry.as_object().unwrap(); + let obj = if let Some(output) = entry.as_object() { + output + } else { + return false; + }; match self { FilterInner::Cond { ref left,