diff options
Diffstat (limited to 'src/tokenizer/error.rs')
-rw-r--r-- | src/tokenizer/error.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/tokenizer/error.rs b/src/tokenizer/error.rs index 0acc88f..dad3fd2 100644 --- a/src/tokenizer/error.rs +++ b/src/tokenizer/error.rs @@ -6,7 +6,12 @@ use std::fmt::Display; pub enum Error { AttributesOnEndTag, SelfClosingEndTag, - DuplicateAttribute, + DuplicateAttribute { + #[cfg(feature = "spans")] + #[cfg_attr(docsrs, doc(cfg(feature = "spans")))] + /// Span of the duplicate attribute name. + span: std::ops::Range<usize>, + }, BadCharacter(char), UnexpectedCharacter(char, InternalState), UnexpectedEOF(InternalState), @@ -22,7 +27,7 @@ impl Display for Error { match self { Error::AttributesOnEndTag => write!(f, "attributes on an end tag"), Error::SelfClosingEndTag => write!(f, "self-closing end tag"), - Error::DuplicateAttribute => write!(f, "duplicate attribute"), + Error::DuplicateAttribute { .. } => write!(f, "duplicate attribute"), Error::BadCharacter(char) => write!(f, "bad character {:?}", char), Error::UnexpectedCharacter(char, state) => { write!( |