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() {
|
||||
Some(Ok(Node::AttributeValue(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),
|
||||
None => return Err(Error::MissingValue(&Kind::Scalar)),
|
||||
}
|
||||
|
|
|
@ -114,8 +114,8 @@ pub enum Error {
|
|||
UnexpectedNode(String),
|
||||
#[error("unexpected state: {0}")]
|
||||
UnexpectedState(&'static str),
|
||||
#[error("expected scalar")]
|
||||
ExpectedScalar,
|
||||
#[error("expected scalar, found {0}")]
|
||||
ExpectedScalar(String),
|
||||
#[error("duplicate value")]
|
||||
DuplicateValue,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue