fix: incorrect error type name
This commit is contained in:
parent
eb9c47c8c8
commit
bc82dc6b41
1 changed files with 3 additions and 3 deletions
|
@ -169,9 +169,9 @@ fn derive_impl(input: syn::DeriveInput) -> syn::Result<TokenStream> {
|
|||
.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::<syn::Result<Vec<_>>>()?;
|
||||
|
@ -211,7 +211,7 @@ fn derive_impl(input: syn::DeriveInput) -> syn::Result<TokenStream> {
|
|||
}
|
||||
|
||||
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<Self, Self::Error> {
|
||||
Ok(Self{
|
||||
|
|
Loading…
Reference in a new issue