aboutsummaryrefslogtreecommitdiffstats
path: root/src/error.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@bunny.garden>2024-11-10 14:31:43 +0000
committerLibravatar cel 🌸 <cel@bunny.garden>2024-11-10 14:31:43 +0000
commitbe50ab4890993ae97bc79138364cd5e316566e46 (patch)
treecedf5db695f1a35a37e0c1df1efe1346d03477ea /src/error.rs
parent593cad573baf239337c5869c92ea9e7aed61e847 (diff)
downloadpeanuts-be50ab4890993ae97bc79138364cd5e316566e46.tar.gz
peanuts-be50ab4890993ae97bc79138364cd5e316566e46.tar.bz2
peanuts-be50ab4890993ae97bc79138364cd5e316566e46.zip
implement element reading
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/error.rs b/src/error.rs
index 78508ae..96c709c 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -1,9 +1,18 @@
-use std::str::Utf8Error;
+use std::{num::ParseIntError, str::Utf8Error};
+
+use crate::element::{Name, Namespace};
pub enum Error {
ReadError(std::io::Error),
Utf8Error(Utf8Error),
ParseError(String),
+ EntityProcessError(String),
+ // TODO: better choice for failures than string
+ InvalidCharRef(String),
+ DuplicateNameSpace(Namespace),
+ DuplicateAttribute(String),
+ UnqualifiedNamespace(String),
+ MismatchedEndTag(String, String),
}
impl From<std::io::Error> for Error {
@@ -17,3 +26,9 @@ impl From<Utf8Error> for Error {
Self::Utf8Error(e)
}
}
+
+impl From<ParseIntError> for Error {
+ fn from(e: ParseIntError) -> Self {
+ Self::InvalidCharRef(e.to_string())
+ }
+}