Skip to content

Commit

Permalink
Update error message string.
Browse files Browse the repository at this point in the history
  • Loading branch information
kschwab committed Jul 12, 2024
1 parent 2f91feb commit 2ca1352
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pydantic_settings/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def get_subcommand(model: BaseModel, is_required: bool = False, is_exit_on_error
return getattr(model, field_name)
subcommands.append(field_name)
if is_required:
error_message = f'CLI subcommand is required {{{", ".join(subcommands)}}}'
error_message = f'Error: CLI subcommand is required {{{", ".join(subcommands)}}}'
raise SystemExit(error_message) if is_exit_on_error else SettingsError(error_message)
return None

Expand Down
4 changes: 2 additions & 2 deletions tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2791,9 +2791,9 @@ class Git(BaseSettings):
'plugins': None,
}
assert get_subcommand(git) is None
with pytest.raises(SystemExit, match='CLI subcommand is required {clone, init, plugins}'):
with pytest.raises(SystemExit, match='Error: CLI subcommand is required {clone, init, plugins}'):
get_subcommand(git, is_required=True)
with pytest.raises(SettingsError, match='CLI subcommand is required {clone, init, plugins}'):
with pytest.raises(SettingsError, match='Error: CLI subcommand is required {clone, init, plugins}'):
get_subcommand(git, is_required=True, is_exit_on_error=False)

git = Git(_cli_parse_args=['init', '--quiet', 'true', 'dir/path'])
Expand Down

0 comments on commit 2ca1352

Please sign in to comment.