Change the Error handling and remove unsed code
This commit is contained in:
parent
11b0622804
commit
21fa21859b
1 changed files with 5 additions and 19 deletions
|
@ -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)))),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue