imag-todo: Move from error-chain to failure

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2018-10-30 18:40:53 +01:00
parent 5821a55c14
commit aff5059652
2 changed files with 6 additions and 3 deletions

View file

@ -24,8 +24,9 @@ maintenance = { status = "actively-developed" }
[dependencies] [dependencies]
log = "0.4.0" log = "0.4.0"
toml = "0.4" toml = "0.4"
toml-query = "0.7" toml-query = { git = "https://github.com/matthiasbeyer/toml-query", branch = "failure" }
is-match = "0.1" is-match = "0.1"
failure = "0.1"
libimagrt = { version = "0.9.0", path = "../../../lib/core/libimagrt" } libimagrt = { version = "0.9.0", path = "../../../lib/core/libimagrt" }
libimagerror = { version = "0.9.0", path = "../../../lib/core/libimagerror" } libimagerror = { version = "0.9.0", path = "../../../lib/core/libimagerror" }

View file

@ -37,6 +37,7 @@ extern crate clap;
extern crate toml; extern crate toml;
extern crate toml_query; extern crate toml_query;
#[macro_use] extern crate is_match; #[macro_use] extern crate is_match;
extern crate failure;
#[macro_use] extern crate libimagrt; #[macro_use] extern crate libimagrt;
extern crate libimagerror; extern crate libimagerror;
@ -45,6 +46,7 @@ extern crate libimagtodo;
use std::process::{Command, Stdio}; use std::process::{Command, Stdio};
use std::io::stdin; use std::io::stdin;
use std::io::Write; use std::io::Write;
use failure::Error;
use libimagrt::runtime::Runtime; use libimagrt::runtime::Runtime;
use libimagrt::setup::generate_runtime_setup; use libimagrt::setup::generate_runtime_setup;
@ -119,7 +121,7 @@ fn list(rt: &Runtime) {
// return Result<T> instead of Result<Option<T>>, which is a real inconvenience. // return Result<T> instead of Result<Option<T>>, which is a real inconvenience.
// //
let no_identifier = |e: &::toml_query::error::Error| -> bool { let no_identifier = |e: &::toml_query::error::Error| -> bool {
is_match!(e.kind(), &::toml_query::error::ErrorKind::IdentifierNotFoundInDocument(_)) is_match!(e, &::toml_query::error::Error::IdentifierNotFoundInDocument(_))
}; };
let res = rt.store().all_tasks() // get all tasks let res = rt.store().all_tasks() // get all tasks
@ -136,7 +138,7 @@ fn list(rt: &Runtime) {
}, },
Err(e) => { Err(e) => {
if !no_identifier(&e) { if !no_identifier(&e) {
trace_error(&e); trace_error(&Error::from(e));
} }
None None
} }