Improve error reporting some more
This commit is contained in:
parent
d5d9c60c53
commit
aab73952a1
|
@ -32,7 +32,7 @@ impl<'cx, 'xml> Deserializer<'cx, 'xml> {
|
||||||
match self.next() {
|
match self.next() {
|
||||||
Some(Ok(Node::AttributeValue(s))) => Ok(s),
|
Some(Ok(Node::AttributeValue(s))) => Ok(s),
|
||||||
Some(Ok(Node::Text(s))) => Ok(s),
|
Some(Ok(Node::Text(s))) => Ok(s),
|
||||||
Some(Ok(_)) => return Err(Error::ExpectedScalar),
|
Some(Ok(node)) => return Err(Error::ExpectedScalar(format!("{node:?}"))),
|
||||||
Some(Err(e)) => return Err(e),
|
Some(Err(e)) => return Err(e),
|
||||||
None => return Err(Error::MissingValue(&Kind::Scalar)),
|
None => return Err(Error::MissingValue(&Kind::Scalar)),
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,8 +114,8 @@ pub enum Error {
|
||||||
UnexpectedNode(String),
|
UnexpectedNode(String),
|
||||||
#[error("unexpected state: {0}")]
|
#[error("unexpected state: {0}")]
|
||||||
UnexpectedState(&'static str),
|
UnexpectedState(&'static str),
|
||||||
#[error("expected scalar")]
|
#[error("expected scalar, found {0}")]
|
||||||
ExpectedScalar,
|
ExpectedScalar(String),
|
||||||
#[error("duplicate value")]
|
#[error("duplicate value")]
|
||||||
DuplicateValue,
|
DuplicateValue,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue