Skip to content

handle req args by parsing and raising#1733

Merged
ifrit98 merged 5 commits intostagingfrom
feature/handle-required-args-gracefully/phil
Mar 21, 2024
Merged

handle req args by parsing and raising#1733
ifrit98 merged 5 commits intostagingfrom
feature/handle-required-args-gracefully/phil

Conversation

@ifrit98
Copy link
Contributor

@ifrit98 ifrit98 commented Mar 6, 2024

No description provided.

Copy link

@wolfentensor wolfentensor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The added code is functionally sound and suited for its purpose. One small comment about the exception type.

missing_required_args = self.__check_for_missing_required_args(parser, args)
if missing_required_args:
# Handle missing required arguments gracefully
raise ValueError(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proper exception to raise is argparse.ArgumentError:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not work here because we don't have access the the arg reference.

@ifrit98 ifrit98 merged commit ceb4986 into staging Mar 21, 2024
@ifrit98 ifrit98 mentioned this pull request Mar 25, 2024
@unconst unconst deleted the feature/handle-required-args-gracefully/phil branch March 27, 2024 20:04
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.

2 participants