Skip to content

fix: make --connect-timeout/--retry-delay error messages consistent with clap style#823

Merged
ryanfowler merged 1 commit into
mainfrom
fix/consistent-timeout-error-messages
Jul 2, 2026
Merged

fix: make --connect-timeout/--retry-delay error messages consistent with clap style#823
ryanfowler merged 1 commit into
mainfrom
fix/consistent-timeout-error-messages

Conversation

@ryanfowler

Copy link
Copy Markdown
Owner

Negative values for --connect-timeout and --retry-delay bypass clap validation (due to allow_hyphen_values) and produced inconsistent error messages:

$ fetch --connect-timeout -5 https://example.com
error: connect-timeout must be a non-negative number

Now they match the clap-consistent pattern:

$ fetch --connect-timeout -5 https://example.com
error: invalid value '-5' for option '--connect-timeout': must be a non-negative number

The new format is automatically parsed into a FetchError::InvalidValue by parse_invalid_value_error in error.rs, giving it proper ANSI styling (yellow value, bold flag).

Validation: cargo test --locked --all-features --lib --bins — all 830 tests pass.

…ith clap style

Error messages for negative --connect-timeout and --retry-delay values
now use the same format as other clap-validated flags:

  invalid value '-5' for option '--connect-timeout': must be a non-negative number

Previously they omitted the -- prefix and the reported value:
  connect-timeout must be a non-negative number
@ryanfowler ryanfowler enabled auto-merge July 2, 2026 00:49
@ryanfowler ryanfowler merged commit 8346b6f into main Jul 2, 2026
4 checks passed
@ryanfowler ryanfowler deleted the fix/consistent-timeout-error-messages branch July 2, 2026 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant