summaryrefslogtreecommitdiffstats
path: root/bin/domain/imag-timetrack/src/list.rs
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-03-07 16:04:33 +0100
committerMatthias Beyer <mail@beyermatthias.de>2020-03-08 11:43:24 +0100
commit8527d447ae2047e0d5d54cc70599a895b62a3ee0 (patch)
tree023de5d446d28c6a232308f8604e17a129ee49c7 /bin/domain/imag-timetrack/src/list.rs
parent00aa4df88edae1d5eeb3fb365af05f95bd0de3b4 (diff)
Replace failure with anyhow in complete codebase
This patch was scripted with sed -i 's/use failure::Error/use anyhow::Error/' $(rg "use failure::Error" -l) sed -i 's/use failure::Fallible as /use anyhow::/' $(rg "use failure::Fallible" -l) sed -i 's/failure/anyhow/' $(rg "failure *=" -l) sed -i 's/format_err!/anyhow!/' $(rg "format_err!" -l) sed -i 's/use failure::ResultExt/use anyhow::Context/' $(rg "use failure::ResultExt" -l) sed -i 's/err_msg/anyhow!/' $(rg "use failure::err_msg" -l) sed -i 's/^anyhow\ *=.*$/anyhow = "1"/' $(rg "anyhow * =" -l) sed -i 's/^anyhow_derive.*//' $(rg "anyhow_derive" -l) sed -i 's/extern crate failure/extern crate anyhow/' $(rg "extern crate failure" -l) sed -i 's/.*extern crate anyhow_derive.*//' $(rg "anyhow_derive" -l) Some manual changes were added as well, so this patch was not completely scripted, but mostly. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'bin/domain/imag-timetrack/src/list.rs')
-rw-r--r--bin/domain/imag-timetrack/src/list.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/bin/domain/imag-timetrack/src/list.rs b/bin/domain/imag-timetrack/src/list.rs
index d158303b..bf9719be 100644
--- a/bin/domain/imag-timetrack/src/list.rs
+++ b/bin/domain/imag-timetrack/src/list.rs
@@ -24,9 +24,9 @@ use prettytable::Cell;
use kairos::parser::Parsed;
use kairos::parser::parse as kairos_parse;
use clap::ArgMatches;
-use failure::Fallible as Result;
-use failure::ResultExt;
-use failure::Error;
+use anyhow::Result;
+use anyhow::Context;
+use anyhow::Error;
use resiter::Filter;
use resiter::AndThen;
use resiter::Map;
@@ -46,13 +46,14 @@ pub fn list(rt: &Runtime) -> Result<()> {
Some(Ok(Parsed::TimeType(tt))) => {
let tt = tt
.calculate()
- .context(format_err!("Failed to calculate date from '{}'", cmd.value_of(name).unwrap()))?;
+ .map_err(|e| Error::from(e.compat()))
+ .context(anyhow!("Failed to calculate date from '{}'", cmd.value_of(name).unwrap()))?;
Ok(tt.get_moment().cloned())
},
Some(Ok(Parsed::Iterator(_))) => {
- Err(format_err!("Expected single point in time, got '{}', which yields a list of dates", cmd.value_of(name).unwrap()))
+ Err(anyhow!("Expected single point in time, got '{}', which yields a list of dates", cmd.value_of(name).unwrap()))
},
- Some(Err(e)) => Err(e),
+ Some(Err(e)) => Err(Error::from(e.compat())),
None => Ok(None),
}
};