diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tagged.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/tagged.rs b/src/tagged.rs index 1fca458..eada376 100644 --- a/src/tagged.rs +++ b/src/tagged.rs @@ -43,9 +43,9 @@ impl<'a> TagStart<'a> /// /// # Errors /// Returns `Err` if the name is not valid UTF-8. - pub fn name(&self) -> Result<&str, Utf8Error> + pub fn name(&self) -> Result<&str, TagStartError> { - std::str::from_utf8(self.name_bytes()) + std::str::from_utf8(self.name_bytes()).map_err(TagStartError::NameNotUTF8) } /// Returns the name as bytes. @@ -101,4 +101,8 @@ pub enum TagStartError /// Invalid attribute. #[error("Invalid attribute")] InvalidAttribute(#[from] AttributeError), + + /// Name is not valid UTF-8. + #[error("Name is not valid UTF-8")] + NameNotUTF8(#[source] Utf8Error), } |