aerogramme/src/dav/error.rs

41 lines
1,012 B
Rust
Raw Normal View History

2024-03-05 15:07:47 +00:00
use quick_xml::events::attributes::AttrError;
#[derive(Debug)]
pub enum ParsingError {
2024-03-05 18:06:04 +00:00
MissingChild,
2024-03-05 15:07:47 +00:00
NamespacePrefixAlreadyUsed,
WrongToken,
TagNotFound,
2024-03-06 09:12:02 +00:00
Utf8Error(std::str::Utf8Error),
2024-03-05 15:07:47 +00:00
QuickXml(quick_xml::Error),
2024-03-06 11:42:27 +00:00
Chrono(chrono::format::ParseError),
Int(std::num::ParseIntError),
2024-03-05 15:07:47 +00:00
Eof
}
impl From<AttrError> for ParsingError {
fn from(value: AttrError) -> Self {
Self::QuickXml(value.into())
}
}
impl From<quick_xml::Error> for ParsingError {
fn from(value: quick_xml::Error) -> Self {
Self::QuickXml(value)
}
}
2024-03-06 09:12:02 +00:00
impl From<std::str::Utf8Error> for ParsingError {
fn from(value: std::str::Utf8Error) -> Self {
Self::Utf8Error(value)
}
}
2024-03-06 11:42:27 +00:00
impl From<chrono::format::ParseError> for ParsingError {
fn from(value: chrono::format::ParseError) -> Self {
Self::Chrono(value)
}
}
impl From<std::num::ParseIntError> for ParsingError {
fn from(value: std::num::ParseIntError) -> Self {
Self::Int(value)
}
}