nasa / fprime-tools

F´ Python tooling and helpers.
https://github.com/nasa/fprime
Apache License 2.0
21 stars 39 forks source link

Python exception with incorrect command-line arguments #127

Closed timcanham closed 1 year ago

timcanham commented 1 year ago
F´ Version 3.x
Affected Component n/a

Problem Description

When an fprime-util command is executed with an incorrect argument, the Python code generates an unhelpful exception stack:

How to Reproduce

$: fprime-util generate -ut
Traceback (most recent call last):
  File "/xxxx/bin/fprime-util", line 8, in <module>
    sys.exit(main())
  File "/xxxx/lib/python3.8/site-packages/fprime/util/__main__.py", line 14, in main
    return fprime.util.build_helper.utility_entry(args=sys.argv[1:])
  File "/xxxx/lib/python3.8/site-packages/fprime/util/build_helper.py", line 219, in utility_entry
    parsed, cmake_args, make_args, parser, runners = parse_args(args)
  File "/xxxx/lib/python3.8/site-packages/fprime/util/build_helper.py", line 209, in parse_args
    cmake_args, make_args = validate(parsed, unknown)
  File "/xxxx/lib/python3.8/site-packages/fprime/util/build_helper.py", line 115, in validate
    d_args = {
  File "/xxxx/lib/python3.8/site-packages/fprime/util/build_helper.py", line 116, in <dictcomp>
    match.group(1): match.group(2)
AttributeError: 'NoneType' object has no attribute 'group'

Expected Behavior

Should print an error like invalid argument "-ut"