helper Error::bad_arg method

This commit is contained in:
SeanOMik 2024-02-23 16:24:53 -05:00
parent 22b6d218bd
commit 70e2985cc4
Signed by: SeanOMik
GPG Key ID: FEC9E2FC15235964
1 changed files with 7 additions and 0 deletions

View File

@ -66,6 +66,13 @@ impl Error {
}
}
pub fn bad_arg(func: Option<&str>, arg_index: i32, arg_name: Option<&str>, error: Arc<Self>) -> 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