simplify handling of ical-related errors

This commit is contained in:
Lennart K
2026-01-16 14:16:22 +01:00
parent 2c67890343
commit 63373ad525
7 changed files with 22 additions and 62 deletions

View File

@@ -26,10 +26,7 @@ pub async fn route_import<C: CalendarStore, S: SubscriptionStore>(
}
let parser = ical::IcalParser::from_slice(body.as_bytes());
let mut cal = parser
.expect_one()
.map_err(rustical_ical::Error::ParserError)?
.mutable();
let mut cal = parser.expect_one()?.mutable();
// Extract calendar metadata
let displayname = cal
@@ -70,12 +67,7 @@ pub async fn route_import<C: CalendarStore, S: SubscriptionStore>(
cal_components.push(CalendarObjectType::Todo);
}
let objects = cal
.into_objects()
.map_err(rustical_ical::Error::ParserError)?
.into_iter()
.map(Into::into)
.collect();
let objects = cal.into_objects()?.into_iter().map(Into::into).collect();
let new_cal = Calendar {
principal,
id: cal_id,