Skip to content

Unify CLI config-failure exit codes via a single ConfigError catch#51

Merged
bencehezso merged 1 commit into
mainfrom
task/unify_cli_exit_codes
Jul 23, 2026
Merged

Unify CLI config-failure exit codes via a single ConfigError catch#51
bencehezso merged 1 commit into
mainfrom
task/unify_cli_exit_codes

Conversation

@bencehezso

Copy link
Copy Markdown
Contributor

Summary

Config-resolution failures had two inconsistent conventions: non-interactive paths called sys.exit(codes.CONFIG), while interactive paths (--profile, --cli, manual prompts) and the --config <bad file> path just returned - meaning the process exited 0 on those failures. A CLI that exits 0 on failure silently breaks any script wrapping it (set -e, &&, $? checks).

This PR routes every config failure through the ConfigError seam introduced in the config-resolution refactor (#50) and maps it to an exit code in exactly one place.

What changed

  • handle_aws / handle_azure: the --config-file failure now raises
    ConfigError instead of returning, and all six per-branch
    try/except ConfigError blocks were removed — resolvers now propagate freely.
  • main(): a single except ConfigError: sys.exit(codes.CONFIG) wraps the
    provider dispatch, so file and credential failures — interactive or not — all
    exit 2 from one choke point.

@bencehezso bencehezso self-assigned this Jul 23, 2026
@bencehezso bencehezso added the enhancement New feature or request label Jul 23, 2026
@bencehezso
bencehezso merged commit 04b18c8 into main Jul 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant