From bc82dc6b41b35d1e77724c6dd97a62fa17597cc1 Mon Sep 17 00:00:00 2001 From: naskya Date: Tue, 16 Jul 2024 02:16:56 +0900 Subject: [PATCH] fix: incorrect error type name --- crates/relax-macros/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/relax-macros/src/lib.rs b/crates/relax-macros/src/lib.rs index f21baaf..372f2ff 100644 --- a/crates/relax-macros/src/lib.rs +++ b/crates/relax-macros/src/lib.rs @@ -169,9 +169,9 @@ fn derive_impl(input: syn::DeriveInput) -> syn::Result { .any(|attr| attr.path().is_ident("relax")); Ok(match (nested, get_generic_ty("Option", ty).is_some()) { - (false, false) => quote! { #name: value.#name.ok_or(::relax::MissingRequiredField(stringify!(#name)))? }, + (false, false) => quote! { #name: value.#name.ok_or(::relax::RequiredFieldNotSet(stringify!(#name)))? }, (false, true) => quote! { #name: value.#name }, - (true, false) => quote! { #name: value.#name.ok_or(::relax::MissingRequiredField(stringify!(#name)))?.try_into()? }, + (true, false) => quote! { #name: value.#name.ok_or(::relax::RequiredFieldNotSet(stringify!(#name)))?.try_into()? }, (true, true) => quote! { #name: value.#name.map(|val| val.try_into()).transpose().ok().flatten() }, }) }).collect::>>()?; @@ -211,7 +211,7 @@ fn derive_impl(input: syn::DeriveInput) -> syn::Result { } impl #generics ::std::convert::TryFrom<#partial #generics> for #base #generics { - type Error = ::relax::MissingRequiredField; + type Error = ::relax::RequiredFieldNotSet; fn try_from(value: #partial) -> ::std::result::Result { Ok(Self{