mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-17 04:18:07 +00:00
Catch argparse type errors (#911)
Catch argparse argument type errors and display them in a simplified fashion. As an example, this is how the output is rendered. ``` ❯ onefuzz template libfuzzer basic --target_env ASAN_OPTIONS=allocator_may_return_null=1 a a a linux unable to parse arguments: unable to parse value as a key=value pair: 'a' ❯ ``` Note, this builds upon #910.
This commit is contained in:
@ -524,7 +524,11 @@ def execute_api(api: Any, api_types: List[Any], version: str) -> int:
|
||||
builder = Builder(api_types)
|
||||
builder.add_version(version)
|
||||
builder.parse_api(api)
|
||||
args = builder.parse_args()
|
||||
try:
|
||||
args = builder.parse_args()
|
||||
except argparse.ArgumentTypeError as err:
|
||||
LOGGER.error("unable to parse arguments: %s", err)
|
||||
return 1
|
||||
|
||||
if args.verbose == 0:
|
||||
logging.basicConfig(level=logging.WARNING)
|
||||
|
Reference in New Issue
Block a user