aboutsummaryrefslogtreecommitdiffstats
path: root/src/element.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/element.rs')
-rw-r--r--src/element.rs20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/element.rs b/src/element.rs
index 48d4d90..b954e2d 100644
--- a/src/element.rs
+++ b/src/element.rs
@@ -89,9 +89,10 @@ impl Element {
if self.name.local_name == name {
Ok(())
} else {
- return Err(DeserializeError::IncorrectName(
- self.name.local_name.clone(),
- ));
+ return Err(DeserializeError::IncorrectName {
+ expected: name.to_string(),
+ found: self.name.local_name.clone(),
+ });
}
}
@@ -99,10 +100,15 @@ impl Element {
if self.name.namespace.as_deref() == Some(namespace) {
return Ok(());
} else {
- if let Some(namespace) = &self.name.namespace {
- return Err(DeserializeError::IncorrectNamespace(namespace.clone()));
+ if let Some(actual_namespace) = &self.name.namespace {
+ return Err(DeserializeError::IncorrectNamespace {
+ expected: namespace.to_string(),
+ found: actual_namespace.clone(),
+ });
} else {
- return Err(DeserializeError::Unqualified);
+ return Err(DeserializeError::Unqualified {
+ expected: namespace.to_string(),
+ });
}
}
}
@@ -358,7 +364,7 @@ impl Element {
let child = self
.content
.pop_front()
- .ok_or(DeserializeError::MissingChild)?;
+ .ok_or(DeserializeError::MissingValue)?;
match child {
Content::Element(_) => {
return Err(DeserializeError::UnexpectedContent(self.content.clone()))