add error handling for tasks

This commit is contained in:
Dustin J. Mitchell
2022-02-01 00:35:02 +00:00
parent 2dc9358085
commit b675cef99c
6 changed files with 93 additions and 52 deletions

View File

@@ -1,3 +1,4 @@
use crate::util::err_to_tcstring;
use crate::{result::TCResult, status::TCStatus, string::TCString, task::TCTask, uuid::TCUuid};
use taskchampion::{Replica, StorageConfig, Uuid};
@@ -75,10 +76,6 @@ impl From<Replica> for TCReplica {
}
}
fn err_to_tcstring(e: impl std::string::ToString) -> TCString<'static> {
TCString::from(e.to_string())
}
/// Utility function to allow using `?` notation to return an error value. This makes
/// a mutable borrow, because most Replica methods require a `&mut`.
fn wrap<'a, T, F>(rep: *mut TCReplica, f: F, err_value: T) -> T