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