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,7 +26,7 @@ pub enum Error {
Other(#[from] anyhow::Error),
#[error(transparent)]
IcalError(#[from] rustical_ical::Error),
IcalError(#[from] ical::parser::ParserError),
}
impl Error {
@@ -36,7 +36,8 @@ impl Error {
Self::NotFound => StatusCode::NOT_FOUND,
Self::AlreadyExists => StatusCode::CONFLICT,
Self::ReadOnly => StatusCode::FORBIDDEN,
Self::IcalError(err) => err.status_code(),
// TODO: Can also be Bad Request, depending on when this is raised
Self::IcalError(_err) => StatusCode::INTERNAL_SERVER_ERROR,
Self::InvalidPrincipalType(_) => StatusCode::BAD_REQUEST,
_ => StatusCode::INTERNAL_SERVER_ERROR,
}