Small change in error catching in validate function

This commit is contained in:
Lucas 2021-09-29 11:04:42 -03:00
parent b6f9c992f5
commit 5f3fe03108

View File

@ -65,12 +65,12 @@ def check_exists_ask_overwrite(arg_value:str) -> bool:
def validate_all_args(parsed_args:dict) -> None: def validate_all_args(parsed_args:dict) -> None:
# Raises ArgumentError if any of the arguments is not validated # Raises AssertionError if any of the arguments is not validated
try: try:
for arg_name, arg_value in parsed_args.items(): for arg_name, arg_value in parsed_args.items():
if not is_argument_valid(arg_name, arg_value): if not is_argument_valid(arg_name, arg_value):
raise argparse.ArgumentError raise AssertionError
except argparse.ArgumentError as e: except AssertionError as e:
raise RuntimeError( raise RuntimeError(
f'The specified {arg_name} "{arg_value}" is not valid.') from e f'The specified {arg_name} "{arg_value}" is not valid.') from e