mirror of
https://github.com/instant-labs/instant-xml.git
synced 2025-02-09 03:22:01 +00:00
Use error variant for field duplicates
This commit is contained in:
parent
ebc29b5761
commit
6c0cb83189
@ -259,7 +259,7 @@ impl Deserializer {
|
||||
tokens.match_.extend(quote!(
|
||||
__Elements::#enum_name => {
|
||||
if #enum_name.is_some() {
|
||||
panic!("duplicated value");
|
||||
return Err(Error::DuplicateValue);
|
||||
}
|
||||
|
||||
let mut nested = deserializer.nested(data);
|
||||
@ -270,7 +270,7 @@ impl Deserializer {
|
||||
tokens.match_.extend(quote!(
|
||||
__Attributes::#enum_name => {
|
||||
if #enum_name.is_some() {
|
||||
panic!("duplicated value");
|
||||
return Err(Error::DuplicateValue);
|
||||
}
|
||||
|
||||
let mut nested = deserializer.for_attr(attr);
|
||||
|
@ -90,4 +90,6 @@ pub enum Error {
|
||||
ExpectedScalar,
|
||||
#[error("wrong namespace")]
|
||||
WrongNamespace,
|
||||
#[error("duplicate value")]
|
||||
DuplicateValue,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user