diff --git a/core/src/fnc/mod.rs b/core/src/fnc/mod.rs index ddc59edd..f89ed27a 100644 --- a/core/src/fnc/mod.rs +++ b/core/src/fnc/mod.rs @@ -74,7 +74,7 @@ macro_rules! dispatch { $($wrapper)*(|| $($function_path)::+($($ctx_arg,)* args))()$(.$await)* },)+ _ => { - return Err($crate::err::Error::InvalidFunction{ + Err($crate::err::Error::InvalidFunction{ name: String::from($name), message: $message.to_string() }) diff --git a/lib/tests/function.rs b/lib/tests/function.rs index 95c65752..aaf5fa45 100644 --- a/lib/tests/function.rs +++ b/lib/tests/function.rs @@ -6237,6 +6237,9 @@ async fn function_idiom_chaining() -> Result<(), Error> { true.is_bool(); true.doesnt_exist(); field.bla.nested.is_none(); + // String is one of the types in the initial match statement, + // this test ensures that the dispatch macro does not exit early + "string".is_bool(); "#; Test::new(sql) .await? @@ -6245,6 +6248,7 @@ async fn function_idiom_chaining() -> Result<(), Error> { .expect_val("false")? .expect_val("true")? .expect_error("There was a problem running the doesnt_exist() function. no such method found for the bool type")? - .expect_val("true")?; + .expect_val("true")? + .expect_val("false")?; Ok(()) }