Skip to content

Refactor cargo-wdk CLI error handling #724

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions