api-macro: fix non-async test case after adding verifiers

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2019-08-16 12:21:31 +02:00
parent 9fd9bd53fd
commit 025eaf5519

View File

@ -286,7 +286,13 @@ pub fn handle_function(
body.push(quote! {
impl #struct_name {
fn #impl_checked_ident(#inputs) -> ::proxmox::api::ApiFuture<#body_type> {
#parameter_verifiers
let check = (|| -> Result<(), Error> {
#parameter_verifiers
Ok(())
})();
if let Err(err) = check {
return Box::pin(async move { Err(err) });
}
Self::#impl_unchecked_ident(#passed_args)
}
}