imag-habit: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
c1bc5d4bf6
commit
8fb35b5fe1
2 changed files with 8 additions and 5 deletions
|
@ -25,9 +25,10 @@ maintenance = { status = "actively-developed" }
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
toml = "0.4"
|
toml = "0.4"
|
||||||
toml-query = "0.7"
|
toml-query = { git = "https://github.com/matthiasbeyer/toml-query", branch = "failure" }
|
||||||
kairos = { git = "https://github.com/matthiasbeyer/kairos", branch = "master" }
|
kairos = { git = "https://github.com/matthiasbeyer/kairos", branch = "failure" }
|
||||||
prettytable-rs = "0.8"
|
prettytable-rs = "0.8"
|
||||||
|
failure = "0.1"
|
||||||
|
|
||||||
libimagerror = { version = "0.9.0", path = "../../../lib/core/libimagerror" }
|
libimagerror = { version = "0.9.0", path = "../../../lib/core/libimagerror" }
|
||||||
libimagstore = { version = "0.9.0", path = "../../../lib/core/libimagstore" }
|
libimagstore = { version = "0.9.0", path = "../../../lib/core/libimagstore" }
|
||||||
|
|
|
@ -39,6 +39,7 @@ extern crate toml_query;
|
||||||
extern crate kairos;
|
extern crate kairos;
|
||||||
extern crate chrono;
|
extern crate chrono;
|
||||||
extern crate prettytable;
|
extern crate prettytable;
|
||||||
|
#[macro_use] extern crate failure;
|
||||||
|
|
||||||
extern crate libimaghabit;
|
extern crate libimaghabit;
|
||||||
extern crate libimagstore;
|
extern crate libimagstore;
|
||||||
|
@ -53,6 +54,7 @@ use std::process::exit;
|
||||||
use prettytable::Table;
|
use prettytable::Table;
|
||||||
use prettytable::Cell;
|
use prettytable::Cell;
|
||||||
use prettytable::Row;
|
use prettytable::Row;
|
||||||
|
use failure::Error;
|
||||||
|
|
||||||
use libimagrt::runtime::Runtime;
|
use libimagrt::runtime::Runtime;
|
||||||
use libimagrt::setup::generate_runtime_setup;
|
use libimagrt::setup::generate_runtime_setup;
|
||||||
|
@ -232,8 +234,7 @@ fn delete(rt: &Runtime) {
|
||||||
// future flag. If it is true, the check will not be performed and it is assumed that `--future`
|
// future flag. If it is true, the check will not be performed and it is assumed that `--future`
|
||||||
// was passed.
|
// was passed.
|
||||||
fn today(rt: &Runtime, future: bool) {
|
fn today(rt: &Runtime, future: bool) {
|
||||||
use libimaghabit::error::ResultExt;
|
use failure::ResultExt;
|
||||||
use libimaghabit::error::HabitErrorKind as HEK;
|
|
||||||
|
|
||||||
let (future, show_done) = {
|
let (future, show_done) = {
|
||||||
if !future {
|
if !future {
|
||||||
|
@ -296,7 +297,8 @@ fn today(rt: &Runtime, future: bool) {
|
||||||
am.value_of("today-show-next-n")
|
am.value_of("today-show-next-n")
|
||||||
.map(|x| {
|
.map(|x| {
|
||||||
x.parse::<usize>()
|
x.parse::<usize>()
|
||||||
.chain_err(|| HEK::from(format!("Cannot parse String '{}' to integer", x)))
|
.context(format_err!("Cannot parse String '{}' to integer", x))
|
||||||
|
.map_err(Error::from)
|
||||||
.map_err_trace_exit_unwrap(1)
|
.map_err_trace_exit_unwrap(1)
|
||||||
})
|
})
|
||||||
}).unwrap_or(5);
|
}).unwrap_or(5);
|
||||||
|
|
Loading…
Reference in a new issue