cool-easter-32542
09/16/2023, 11:36 AM> pants list --type=scala_library ::
timestamp: 2018-11-02T09:35:30.912793
Exception caught: (pants.option.errors.ParseError)
File "/Users/sdelmore/.pex/install/pantsbuild.pants-1.11.0rc0+f9a61c0c-cp27-none-macosx_10_11_x86_64.whl.545e36657048c66e803f821fe09b152f4e558d92/pantsbuild.pants-1.11.0rc0+f9a61c0c-cp27-none-macosx_10_11_x86_64.whl/pants/bin/daemon_pants_runner.py", line 320, in post_fork_child
self._options_bootstrapper
File "/Users/sdelmore/.pex/install/pantsbuild.pants-1.11.0rc0+f9a61c0c-cp27-none-macosx_10_11_x86_64.whl.545e36657048c66e803f821fe09b152f4e558d92/pantsbuild.pants-1.11.0rc0+f9a61c0c-cp27-none-macosx_10_11_x86_64.whl/pants/bin/local_pants_runner.py", line 95, in create
options.for_scope(scope)
File "/Users/sdelmore/.pex/install/pantsbuild.pants-1.11.0rc0+f9a61c0c-cp27-none-macosx_10_11_x86_64.whl.545e36657048c66e803f821fe09b152f4e558d92/pantsbuild.pants-1.11.0rc0+f9a61c0c-cp27-none-macosx_10_11_x86_64.whl/pants/option/options.py", line 401, in for_scope
self._parser_hierarchy.get_parser_by_scope(scope).parse_args(flags_in_scope, values)
File "/Users/sdelmore/.pex/install/pantsbuild.pants-1.11.0rc0+f9a61c0c-cp27-none-macosx_10_11_x86_64.whl.545e36657048c66e803f821fe09b152f4e558d92/pantsbuild.pants-1.11.0rc0+f9a61c0c-cp27-none-macosx_10_11_x86_64.whl/pants/option/parser.py", line 225, in parse_args
self._scope_str(), ', '.join(flag_value_map.keys())))
Exception message: Unrecognized command line flags on scope 'list': --type
While it's perfectly reasonable to use the traceback that python gives us, we probably have the opportunity to clean it up a bit and convert (in this case) /Users/sdelmore/.pex/install/pantsbuild.pants-1.11.0rc0+f9a61c0c-cp27-none-macosx_10_11_x86_64.whl.545e36657048c66e803f821fe09b152f4e558d92/pantsbuild.pants-1.11.0rc0+f9a61c0c-cp27-none-macosx_10_11_x86_64.whl/pants/option/parser.py to (potentially) something that doesn't have the wheel path in it, which might look something like:
> pants list --type=scala_library ::
timestamp: 2018-11-02T09:35:30.912793
pants is located in: /Users/sdelmore/.pex/install/pantsbuild.pants-1.11.0rc0+f9a61c0c-cp27-none-macosx_10_11_x86_64.whl.545e36657048c66e803f821fe09b152f4e558d92/pantsbuild.pants-1.11.0rc0+f9a61c0c-cp27-none-macosx_10_11_x86_64.whl
Exception caught: (pants.option.errors.ParseError)
File ".../pants/bin/daemon_pants_runner.py", line 320, in post_fork_child
self._options_bootstrapper
File ".../pants/bin/local_pants_runner.py", line 95, in create
options.for_scope(scope)
File ".../pants/option/options.py", line 401, in for_scope
self._parser_hierarchy.get_parser_by_scope(scope).parse_args(flags_in_scope, values)
File ".../pants/option/parser.py", line 225, in parse_args
self._scope_str(), ', '.join(flag_value_map.keys())))
Exception message: Unrecognized command line flags on scope 'list': --type
Note the single location at the top, making the subsequent traceback much neater. I'm thinking we could do this very easily in the sys.excepthook we set in ExceptionSink by manipulating the traceback to find stack frames within the pants pex, simplifying them, then displaying the location at the top of the traceback as above.
pantsbuild/pantscool-easter-32542
09/16/2023, 11:36 AM