diff --git a/Cargo.lock b/Cargo.lock index e90b17e..ea545d1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -233,7 +233,7 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fb" -version = "0.2.0" +version = "0.2.1" dependencies = [ "dirs", "gumdrop", diff --git a/Cargo.toml b/Cargo.toml index f634296..477d648 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fb" -version = "0.2.0" +version = "0.2.1" edition = "2021" license = "Apache-2.0" diff --git a/src/args.rs b/src/args.rs index 1376826..fe519f0 100644 --- a/src/args.rs +++ b/src/args.rs @@ -164,7 +164,7 @@ pub fn get_args() -> Result> { } match fs::read_to_string(&jwt_path) { Ok(jwt) => args.jwt = String::from(jwt.trim()), - Err(error) => eprintln!("Failed to read jwt from {:?}: {:?}", &jwt_path, error), + Err(error) => eprintln!("Failed to read jwt from {:?}: {}", &jwt_path, error.to_string()), } } diff --git a/src/auth.rs b/src/auth.rs index 5a41a1e..43d634c 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -122,7 +122,13 @@ pub async fn authenticate_service_account(context: &mut Context) -> Result<(), B ); } } - Err(error) => return Err(format!("Failed to authenticate: {:?}", error).into()), + Err(error) => { + if context.args.verbose { + return Err(format!("Failed to authenticate: {:?}", error).into()); + } + + return Err(format!("Failed to authenticate: {}", error.to_string()).into()); + } }; return Ok(()); diff --git a/src/query.rs b/src/query.rs index 19691d9..a7719d5 100644 --- a/src/query.rs +++ b/src/query.rs @@ -192,7 +192,13 @@ pub async fn query(context: &mut Context, query_text: String) -> Result<(), Box< // on stdout, on purpose println!("{}", resp.text().await?); } - Err(error) => eprintln!("Failed to send the request: {:?}", error), + Err(error) => { + if context.args.verbose { + eprintln!("Failed to send the request: {:?}", error); + } else { + eprintln!("Failed to send the request: {}", error.to_string()); + } + }, }; if !context.args.concise {