Print errors (dbg) when import_task() failed
This commit is contained in:
parent
b3b90e5303
commit
5ed60f48cd
3 changed files with 12 additions and 0 deletions
|
@ -17,3 +17,6 @@ path = "../libimagstore"
|
|||
[dependencies.libimagerror]
|
||||
path = "../libimagerror"
|
||||
|
||||
[dependencies.libimagutil]
|
||||
path = "../libimagutil"
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ extern crate serde_json;
|
|||
|
||||
#[macro_use] extern crate libimagstore;
|
||||
#[macro_use] extern crate libimagerror;
|
||||
extern crate libimagutil;
|
||||
extern crate task_hookrs;
|
||||
|
||||
module_entry_path_mod!("todo");
|
||||
|
|
|
@ -11,6 +11,8 @@ use task_hookrs::import::{import_task, import_tasks};
|
|||
|
||||
use libimagstore::store::{FileLockEntry, Store};
|
||||
use libimagstore::storeid::{IntoStoreId, StoreIdIterator, StoreId};
|
||||
use libimagerror::trace::MapErrTrace;
|
||||
use libimagutil::debug_result::DebugResult;
|
||||
use module_path::ModuleEntryPath;
|
||||
|
||||
use error::{TodoError, TodoErrorKind, MapErrInto};
|
||||
|
@ -32,6 +34,8 @@ impl<'a> Task<'a> {
|
|||
r.read_line(&mut line);
|
||||
import_task(&line.as_str())
|
||||
.map_err_into(TodoErrorKind::ImportError)
|
||||
.map_dbg_err_str("Error while importing task")
|
||||
.map_err_dbg_trace()
|
||||
.and_then(|t| {
|
||||
let uuid = t.uuid().clone();
|
||||
t.into_task(store).map(|t| (t, line, uuid))
|
||||
|
@ -61,6 +65,8 @@ impl<'a> Task<'a> {
|
|||
pub fn get_from_string(store: &'a Store, s: String) -> Result<RResult<Task<'a>, String>> {
|
||||
import_task(s.as_str())
|
||||
.map_err_into(TodoErrorKind::ImportError)
|
||||
.map_dbg_err_str("Error while importing task")
|
||||
.map_err_dbg_trace()
|
||||
.map(|t| t.uuid().clone())
|
||||
.and_then(|uuid| Task::get_from_uuid(store, uuid))
|
||||
.and_then(|o| match o {
|
||||
|
@ -96,6 +102,8 @@ impl<'a> Task<'a> {
|
|||
Ok(task) => Ok(task),
|
||||
Err(string) => import_task(string.as_str())
|
||||
.map_err_into(TodoErrorKind::ImportError)
|
||||
.map_dbg_err_str("Error while importing task")
|
||||
.map_err_dbg_trace()
|
||||
.and_then(|t| t.into_task(store)),
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue