Skip to content

Commit

Permalink
Provide helpful error when MetadataAction options have an invalid value
Browse files Browse the repository at this point in the history
  • Loading branch information
jjjake committed Dec 13, 2024
1 parent a390476 commit fa278cc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internetarchive/cli/cli_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ def __call__(self, parser, namespace, values, option_string=None):
for sublist in values:
if ":" not in sublist and "=" in sublist:
sublist = sublist.replace("=", ":", 1)
key, value = sublist.split(":", 1)
try:
key, value = sublist.split(":", 1)
except ValueError:
parser.error(f"{option_string} must be formatted as 'KEY:VALUE'")

current_dict = getattr(namespace, self.dest)
if key in current_dict:
Expand Down

0 comments on commit fa278cc

Please sign in to comment.