From 647bd0f70617c7cf7fb6f580f146b513a14c3468 Mon Sep 17 00:00:00 2001 From: Robert Detjens Date: Tue, 18 Jun 2024 18:13:07 -0700 Subject: [PATCH] use anyhow! macro to build errors Signed-off-by: Robert Detjens --- src/commands/check_access.rs | 2 +- src/configparser/mod.rs | 6 ++---- src/main.rs | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/commands/check_access.rs b/src/commands/check_access.rs index 54841c3..8bac5c7 100644 --- a/src/commands/check_access.rs +++ b/src/commands/check_access.rs @@ -67,5 +67,5 @@ fn check_profile( results .into_iter() .collect::>() - .with_context(|| format!("error in profile {profile_name}:")) + .with_context(|| format!("error in profile {profile_name}")) } diff --git a/src/configparser/mod.rs b/src/configparser/mod.rs index b0530bb..b048272 100644 --- a/src/configparser/mod.rs +++ b/src/configparser/mod.rs @@ -1,7 +1,7 @@ pub mod challenge; pub mod config; -use anyhow::{Error, Result}; +use anyhow::{anyhow, Error, Result}; use itertools::Itertools; use simplelog::*; use std::sync::OnceLock; @@ -31,9 +31,7 @@ pub fn get_profile_config(profile_name: &str) -> Result<&config::ProfileConfig> get_config()? .profiles .get(profile_name) - .ok_or(Error::msg(format!( - "profile {profile_name} not found in config" - ))) + .ok_or(anyhow!("profile {profile_name} not found in config")) } /// get challenges from global, or load from files if not parsed yet diff --git a/src/main.rs b/src/main.rs index 727f3c7..7bf7383 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,7 +19,7 @@ fn main() { ) .unwrap(); - debug!("args: {:?}", cli); + trace!("args: {:?}", cli); // dispatch commands match &cli.command {