aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-05-14 17:00:17 +0200
committerHampusM <hampus@hampusmat.com>2023-05-14 17:00:17 +0200
commit2e4f293cee28cd5fb62ed5e8c95472764f5f5143 (patch)
treeda0ca4a900e5c55e051a7144c8f16ad16fea6e5f /src
parent1621882905b6bfd911e0b0ac8be5c369f2707b31 (diff)
refactor: make the TagStart name function error type TagStartError
Diffstat (limited to 'src')
-rw-r--r--src/tagged.rs8
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),
}