is there any significant benefit we are getting for constructing the clap::Error object here? Can't this be a simple anyhow::anyhow!()
Originally posted by Krishna Kumar Thokala (@krishnakumar4a4) in #702 (comment)
Problem
Cli::run() returns anyhow::Result, so ? converts any errors from lower layers and CLI validation errors (e.g signmode-args, inf2cat-args) causing main() to print them via error!("{e:#}"). This strips clap native formatting, prefixes the error with another ERROR and returns ExitCode 1 even for usage errors.
By deciding a policy for CLI validation vs other runtime errors, error handling and reporting in cargo-wdk can be made uniform.
is there any significant benefit we are getting for constructing the
clap::Errorobject here? Can't this be a simpleanyhow::anyhow!()Originally posted by Krishna Kumar Thokala (@krishnakumar4a4) in #702 (comment)
Problem
Cli::run()returnsanyhow::Result, so?converts any errors from lower layers and CLI validation errors (e.gsignmode-args,inf2cat-args) causingmain()to print them viaerror!("{e:#}"). This stripsclapnative formatting, prefixes the error with anotherERRORand returnsExitCode 1even for usage errors.By deciding a policy for CLI validation vs other runtime errors, error handling and reporting in
cargo-wdkcan be made uniform.