mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 19:22:26 +00:00
xml: Replace missing field unwrap with error
This commit is contained in:
@@ -157,7 +157,8 @@ impl Field {
|
||||
(false, true, false) => quote! { builder.#builder_field_ident },
|
||||
(false, false, true) => quote! { builder.#builder_field_ident },
|
||||
(false, false, false) => {
|
||||
quote! { builder.#builder_field_ident.expect("todo: handle missing field") }
|
||||
let field_ident = self.field_ident().into_token_stream().to_string();
|
||||
quote! { builder.#builder_field_ident.ok_or(::rustical_xml::XmlDeError::MissingField(#field_ident))? }
|
||||
}
|
||||
};
|
||||
quote! { #target_field_index: #builder_value }
|
||||
|
||||
Reference in New Issue
Block a user