mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 16:32:29 +00:00
store, store_sqlite: Refactor error typing
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
error::Error,
|
||||
model::{AddressObject, Addressbook},
|
||||
Error,
|
||||
};
|
||||
use async_trait::async_trait;
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ pub enum Error {
|
||||
InvalidData(String),
|
||||
|
||||
#[error(transparent)]
|
||||
Other(#[from] anyhow::Error),
|
||||
ParserError(#[from] ical::parser::ParserError),
|
||||
|
||||
#[error(transparent)]
|
||||
ParserError(#[from] ical::parser::ParserError),
|
||||
Other(#[from] anyhow::Error),
|
||||
}
|
||||
|
||||
@@ -130,9 +130,9 @@ impl CalDateTime {
|
||||
return Ok(CalDateTime::OlsonTZ(datetime));
|
||||
} else {
|
||||
// This time does not exist because there's a gap in local time
|
||||
return Err(Error::Other(anyhow!(
|
||||
"Timestamp doesn't exist because of gap in local time"
|
||||
)));
|
||||
return Err(Error::InvalidData(
|
||||
"Timestamp doesn't exist because of gap in local time".to_owned(),
|
||||
));
|
||||
}
|
||||
}
|
||||
return Ok(CalDateTime::Local(datetime));
|
||||
@@ -145,7 +145,7 @@ impl CalDateTime {
|
||||
return Ok(CalDateTime::Date(date));
|
||||
}
|
||||
|
||||
Err(Error::Other(anyhow!("Invalid datetime format")))
|
||||
Err(Error::InvalidData("Invalid datetime format".to_owned()))
|
||||
}
|
||||
|
||||
pub fn utc(&self) -> DateTime<Utc> {
|
||||
|
||||
Reference in New Issue
Block a user