diff options
author | schwente <sascha.schwenteck@hs-furtwangen.de> | 2016-06-08 12:54:11 +0200 |
---|---|---|
committer | schwente <sascha.schwenteck@hs-furtwangen.de> | 2016-06-08 12:54:11 +0200 |
commit | 21fa21859b93733638c226a91caabfd65c8204f0 (patch) | |
tree | 7d770c5aca2d70dd2bd57a3328410fd35fcac2a4 /libimagtodo | |
parent | 11b0622804a4766d5d173f93862aad751781f579 (diff) |
Change the Error handling and remove unsed code
Diffstat (limited to 'libimagtodo')
-rw-r--r-- | libimagtodo/src/delete.rs | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/libimagtodo/src/delete.rs b/libimagtodo/src/delete.rs index 13d418bf..317deaa0 100644 --- a/libimagtodo/src/delete.rs +++ b/libimagtodo/src/delete.rs @@ -1,9 +1,3 @@ -// Needed for reading a Json File -// extern crate rustc_serialize; -// use rustc_serialize::json::Json; -// use std::fs::File; -// use std::io::Read; - use uuid::Uuid; use libimagstore::store::Store; @@ -12,22 +6,14 @@ use module_path::ModuleEntryPath; use error::{TodoError, TodoErrorKind}; -/// With the uuid we get the storeid and than we can delete the entry -pub fn deleteFunc(uuid: Uuid, store : &Store) { - // With this we can read from a .json File - // let mut file = File::open("text.json").unwrap(); - // let mut data = String::new(); - // file.rad_to_string(&mut data).unwrap(); - // - // let jeson = Json::from_str(&data).unwrap(); - // println!("{}", json.find_path(&["uuid"]).unwrap()); - +/// With the uuid we get the storeid and then we can delete the entry +pub fn deleteFunc(uuid: Uuid, store : &Store) -> Result<(),TodoError> { // With the uuid we get the storeid let store_id = ModuleEntryPath::new(format!("taskwarrior/{}", uuid)).into_storeid(); // It deletes an entry - if let Err(e) = store.delete(store_id) { - return Err(TodoError::new(TodoErrorKind::StoreError, Some(Box::new(e)))).unwrap(); + match store.delete(store_id) { + Ok(val) => Ok(val), + Err(e) => Err(TodoError::new(TodoErrorKind::StoreError, Some(Box::new(e)))), } - } |