mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 01:12:24 +00:00
xml: Some work on errors
This commit is contained in:
@@ -30,10 +30,12 @@ impl rustical_xml::ValueDeserialize for CalendarObjectType {
|
||||
"VEVENT" => Ok(Self::Event),
|
||||
"VTODO" => Ok(Self::Todo),
|
||||
"VJOURNAL" => Ok(Self::Journal),
|
||||
_ => Err(rustical_xml::XmlError::Other(format!(
|
||||
"Invalid value '{}', must be VEVENT, VTODO, or VJOURNAL",
|
||||
val
|
||||
))),
|
||||
_ => Err(rustical_xml::XmlError::InvalidValue(
|
||||
rustical_xml::ParseValueError::Other(format!(
|
||||
"Invalid value '{}', must be VEVENT, VTODO, or VJOURNAL",
|
||||
val
|
||||
)),
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,9 @@ impl ValueDeserialize for UtcDateTime {
|
||||
Ok(Self(
|
||||
NaiveDateTime::parse_from_str(&input, UTC_DATE_TIME)
|
||||
.map_err(|_| {
|
||||
rustical_xml::XmlError::Other("Could not parse as UTC timestamp".to_owned())
|
||||
rustical_xml::XmlError::InvalidValue(rustical_xml::ParseValueError::Other(
|
||||
"Could not parse as UTC timestamp".to_owned(),
|
||||
))
|
||||
})?
|
||||
.and_utc(),
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user