Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annoying traceback instead of error message #3273

Closed
ericriff opened this issue Oct 23, 2020 · 2 comments · Fixed by sdispater/clikit#38
Closed

Annoying traceback instead of error message #3273

ericriff opened this issue Oct 23, 2020 · 2 comments · Fixed by sdispater/clikit#38
Labels
status/duplicate Duplicate issues

Comments

@ericriff
Copy link

ericriff commented Oct 23, 2020

If you run an invalid command you get a looong traceback that hides the actual error message. I don't think those tracebacks are needed.
See the following example with a typo on help:

$ poetry --hrlp            

  Stack trace:

  11  /opt/poetry/lib/poetry/_vendor/py3.6/clikit/console_application.py:124 in run
      self, args, input_stream, output_stream, error_stream

  10  /opt/poetry/lib/poetry/console/config/application_config.py:221 in create_io
      resolved_command = application.resolve_command(args)

   9  /opt/poetry/lib/poetry/_vendor/py3.6/clikit/console_application.py:110 in resolve_command
      return self._config.command_resolver.resolve(args, self)

   8  /opt/poetry/lib/poetry/_vendor/py3.6/clikit/resolver/default_resolver.py:43 in resolve
      result = self.process_default_commands(args, application.default_commands)

   7  /opt/poetry/lib/poetry/_vendor/py3.6/clikit/resolver/default_resolver.py:104 in process_default_commands
      if resolved_command.is_parsable():

   6  /opt/poetry/lib/poetry/_vendor/py3.6/clikit/resolver/resolve_result.py:43 in is_parsable
      self._parse()

   5  /opt/poetry/lib/poetry/_vendor/py3.6/clikit/resolver/resolve_result.py:49 in _parse
      self._parsed_args = self._command.parse(self._raw_args)

   4  /opt/poetry/lib/poetry/_vendor/py3.6/clikit/api/command/command.py:113 in parse
      return self._config.args_parser.parse(args, self._args_format, lenient)

   3  /opt/poetry/lib/poetry/_vendor/py3.6/clikit/args/default_args_parser.py:53 in parse
      self._parse(args, _fmt, lenient)

   2  /opt/poetry/lib/poetry/_vendor/py3.6/clikit/args/default_args_parser.py:101 in _parse
      self._parse_long_option(token, tokens, fmt, lenient)

   1  /opt/poetry/lib/poetry/_vendor/py3.6/clikit/args/default_args_parser.py:247 in _parse_long_option
      self._add_long_option(name, None, tokens, fmt, lenient)

  NoSuchOptionException

  The "--hrlp" option does not exist.

  at /opt/poetry/lib/poetry/_vendor/py3.6/clikit/args/default_args_parser.py:300 in _add_long_option
      296│     def _add_long_option(
      297│         self, name, value, tokens, fmt, lenient
      298│     ):  # type: (str, Optional[str], List[str], ArgsFormat, bool) -> None
      299│         if not fmt.has_option(name):
    → 300│             raise NoSuchOptionException(name)
      301│ 
      302│         option = fmt.get_option(name)
      303│ 
      304│         if value is False:

It should only show

  NoSuchOptionException

  The "--hrlp" option does not exist.

This is on the latest poetry version, 1.1.3.

@abn
Copy link
Member

abn commented Oct 23, 2020

Duplicate of #2854

@abn abn marked this as a duplicate of #2854 Oct 23, 2020
@abn abn closed this as completed Oct 23, 2020
@abn abn added the status/duplicate Duplicate issues label Oct 23, 2020
Copy link

github-actions bot commented Mar 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status/duplicate Duplicate issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants