summaryrefslogtreecommitdiffstats
path: root/bin/domain/imag-habit
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-10-30 18:40:53 +0100
committerMatthias Beyer <mail@beyermatthias.de>2018-10-30 18:46:29 +0100
commit8fb35b5fe1c0a81a746892f4e4df01a51db74b9f (patch)
tree08a874e9a80050c06368095213f97a1ec8755d78 /bin/domain/imag-habit
parentc1bc5d4bf69b0a9042aa55f5dac1b3d99d533f99 (diff)
imag-habit: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'bin/domain/imag-habit')
-rw-r--r--bin/domain/imag-habit/Cargo.toml5
-rw-r--r--bin/domain/imag-habit/src/main.rs8
2 files changed, 8 insertions, 5 deletions
diff --git a/bin/domain/imag-habit/Cargo.toml b/bin/domain/imag-habit/Cargo.toml
index 7aee14ae..b7018bfa 100644
--- a/bin/domain/imag-habit/Cargo.toml
+++ b/bin/domain/imag-habit/Cargo.toml
@@ -25,9 +25,10 @@ maintenance = { status = "actively-developed" }
chrono = "0.4"
log = "0.4"
toml = "0.4"
-toml-query = "0.7"
-kairos = { git = "https://github.com/matthiasbeyer/kairos", branch = "master" }
+toml-query = { git = "https://github.com/matthiasbeyer/toml-query", branch = "failure" }
+kairos = { git = "https://github.com/matthiasbeyer/kairos", branch = "failure" }
prettytable-rs = "0.8"
+failure = "0.1"
libimagerror = { version = "0.9.0", path = "../../../lib/core/libimagerror" }
libimagstore = { version = "0.9.0", path = "../../../lib/core/libimagstore" }
diff --git a/bin/domain/imag-habit/src/main.rs b/bin/domain/imag-habit/src/main.rs
index 63246fd8..6f81e077 100644
--- a/bin/domain/imag-habit/src/main.rs
+++ b/bin/domain/imag-habit/src/main.rs
@@ -39,6 +39,7 @@ extern crate toml_query;
extern crate kairos;
extern crate chrono;
extern crate prettytable;
+#[macro_use] extern crate failure;
extern crate libimaghabit;
extern crate libimagstore;
@@ -53,6 +54,7 @@ use std::process::exit;
use prettytable::Table;
use prettytable::Cell;
use prettytable::Row;
+use failure::Error;
use libimagrt::runtime::Runtime;
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`
// was passed.
fn today(rt: &Runtime, future: bool) {
- use libimaghabit::error::ResultExt;
- use libimaghabit::error::HabitErrorKind as HEK;
+ use failure::ResultExt;
let (future, show_done) = {
if !future {
@@ -296,7 +297,8 @@ fn today(rt: &Runtime, future: bool) {
am.value_of("today-show-next-n")
.map(|x| {
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)
})
}).unwrap_or(5);