Skip to content

Commit

Permalink
comment - 3
Browse files Browse the repository at this point in the history
  • Loading branch information
ric-evans committed Dec 6, 2024
1 parent ba899a2 commit 41e0c55
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rest_tools/server/arghandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _universal_to_bool(val: Any) -> bool:
INVALID_CHOICE_PATTERN = re.compile(r"(argument .+: invalid choice: .+)")

# argument --reco_algo: cannot be empty string / whitespace
CATCH_MOST_PATTERN = re.compile(r"(argument .+: .+)")
FROM_ARGUMENT_TYPE_ERROR_PATTERN = re.compile(r"(argument .+: .+)")


###############################################################################
Expand Down Expand Up @@ -213,9 +213,9 @@ def _translate_error(
elif match := INVALID_CHOICE_PATTERN.search(err_msg):
return match.group(1).replace("--", "")

# CATCH MOST (not quite 'catch all') -- covers errors in this known format
# argparse.ArgumentTypeError errors -- covers errors in this known format
# -> this is matched when the server code raises argparse.ArgumentTypeError
elif match := CATCH_MOST_PATTERN.search(err_msg):
elif match := FROM_ARGUMENT_TYPE_ERROR_PATTERN.search(err_msg):
return match.group(1).replace("--", "")

# FALL-THROUGH -- log unknown exception
Expand Down

0 comments on commit 41e0c55

Please sign in to comment.