Replace 'failure' crate with anyhow+thiserror

Closes #148
This commit is contained in:
dbr
2021-03-25 16:33:35 +11:00
parent 3cccdc7e32
commit 4d9755c43b
41 changed files with 255 additions and 316 deletions

View File

@@ -3,7 +3,6 @@ use crate::invocation::filtered_tasks;
use crate::report::{Column, Property, Report, SortBy};
use crate::table;
use config::Config;
use failure::{format_err, Fallible};
use prettytable::{Row, Table};
use std::cmp::Ordering;
use taskchampion::{Replica, Task, WorkingSet};
@@ -83,13 +82,13 @@ pub(super) fn display_report<W: WriteColor>(
settings: &Config,
report_name: String,
filter: Filter,
) -> Fallible<()> {
) -> anyhow::Result<()> {
let mut t = Table::new();
let working_set = replica.working_set()?;
// Get the report from settings
let mut report = Report::from_config(settings.get(&format!("reports.{}", report_name))?)
.map_err(|e| format_err!("report.{}{}", report_name, e))?;
.map_err(|e| anyhow::anyhow!("report.{}{}", report_name, e))?;
// include any user-supplied filter conditions
report.filter = report.filter.intersect(filter);