[minor] Logs
This commit is contained in:
parent
f750257b3b
commit
85d8b9f7fd
2 changed files with 7 additions and 7 deletions
|
@ -24,7 +24,7 @@ const MAIN_FILE: &str = "data.json";
|
||||||
|
|
||||||
/// A CalDAV source that stores its items in a local folder.
|
/// A CalDAV source that stores its items in a local folder.
|
||||||
///
|
///
|
||||||
/// It automatically updates the content of the folder when dropped (see its `Drop` implementation), but you can also manually call [`save_to_folder`]
|
/// It automatically updates the content of the folder when dropped (see its `Drop` implementation), but you can also manually call [`Cache::save_to_folder`]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Cache {
|
pub struct Cache {
|
||||||
backing_folder: PathBuf,
|
backing_folder: PathBuf,
|
||||||
|
@ -174,7 +174,7 @@ impl Cache {
|
||||||
impl Drop for Cache {
|
impl Drop for Cache {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if let Err(err) = self.save_to_folder() {
|
if let Err(err) = self.save_to_folder() {
|
||||||
log::error!("Unable to automatically save the cache when it's no longer required");
|
log::error!("Unable to automatically save the cache when it's no longer required: {}", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ mod tests {
|
||||||
|
|
||||||
let mut cache = Cache::new(&cache_path);
|
let mut cache = Cache::new(&cache_path);
|
||||||
|
|
||||||
let shopping_list = cache.create_calendar(
|
let _shopping_list = cache.create_calendar(
|
||||||
Url::parse("https://caldav.com/shopping").unwrap(),
|
Url::parse("https://caldav.com/shopping").unwrap(),
|
||||||
"My shopping list".to_string(),
|
"My shopping list".to_string(),
|
||||||
SupportedComponents::TODO,
|
SupportedComponents::TODO,
|
||||||
|
|
|
@ -321,10 +321,10 @@ where
|
||||||
// TODO: implement update_item (maybe only create_item also updates it?)
|
// TODO: implement update_item (maybe only create_item also updates it?)
|
||||||
//
|
//
|
||||||
if let Err(err) = cal_local.immediately_delete_item(&id_change).await {
|
if let Err(err) = cal_local.immediately_delete_item(&id_change).await {
|
||||||
result.error(&format!("Unable to delete item {} from local calendar: {}", id_change, err));
|
result.error(&format!("Unable to delete (update) item {} from local calendar: {}", id_change, err));
|
||||||
}
|
}
|
||||||
if let Err(err) = cal_local.add_item(item.clone()).await {
|
if let Err(err) = cal_local.add_item(item.clone()).await {
|
||||||
result.error(&format!("Unable to add item {} to local calendar: {}", id_change, err));
|
result.error(&format!("Unable to add (update) item {} to local calendar: {}", id_change, err));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -366,10 +366,10 @@ where
|
||||||
// TODO: implement update_item (maybe only create_item also updates it?)
|
// TODO: implement update_item (maybe only create_item also updates it?)
|
||||||
//
|
//
|
||||||
if let Err(err) = cal_remote.delete_item(&id_change).await {
|
if let Err(err) = cal_remote.delete_item(&id_change).await {
|
||||||
result.error(&format!("Unable to delete item {} from remote calendar: {}", id_change, err));
|
result.error(&format!("Unable to delete (update) item {} from remote calendar: {}", id_change, err));
|
||||||
}
|
}
|
||||||
match cal_remote.add_item(item.clone()).await {
|
match cal_remote.add_item(item.clone()).await {
|
||||||
Err(err) => log::error!("Unable to add item {} to remote calendar: {}", id_change, err),
|
Err(err) => log::error!("Unable to add (update) item {} to remote calendar: {}", id_change, err),
|
||||||
Ok(new_ss) => {
|
Ok(new_ss) => {
|
||||||
// Update local sync status
|
// Update local sync status
|
||||||
item.set_sync_status(new_ss);
|
item.set_sync_status(new_ss);
|
||||||
|
|
Loading…
Add table
Reference in a new issue