diff --git a/instant-xml/src/de.rs b/instant-xml/src/de.rs index 987ea94..2e40e50 100644 --- a/instant-xml/src/de.rs +++ b/instant-xml/src/de.rs @@ -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)), } diff --git a/instant-xml/src/lib.rs b/instant-xml/src/lib.rs index 3a74945..f034c54 100644 --- a/instant-xml/src/lib.rs +++ b/instant-xml/src/lib.rs @@ -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, }