From 70e2985cc44fdb30cdf2157c50d2f0e3385e08fa Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Fri, 23 Feb 2024 16:24:53 -0500 Subject: [PATCH] helper Error::bad_arg method --- src/error.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/error.rs b/src/error.rs index e98b157..88a3a74 100755 --- a/src/error.rs +++ b/src/error.rs @@ -66,6 +66,13 @@ impl Error { } } + pub fn bad_arg(func: Option<&str>, arg_index: i32, arg_name: Option<&str>, error: Arc) -> Self { + let func = func.map(|s| s.to_string()); + let arg_name = arg_name.map(|s| s.to_string()); + + Self::BadArgument { func, arg_index, arg_name, error } + } + /// Throw the error in lua. /// /// This method never returns