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

core.py: Make error messages more verbose #2453

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/click/core.py
Expand Up @@ -2655,7 +2655,9 @@ def _parse_decls(
if name is None:
if not expose_value:
return None, opts, secondary_opts
raise TypeError("Could not determine name for option")
raise TypeError(
f"Could not determine name for option with declarations {decls!r}"
)

if not opts and not secondary_opts:
raise TypeError(
Expand Down Expand Up @@ -2995,7 +2997,7 @@ def _parse_decls(
if not decls:
if not expose_value:
return None, [], []
raise TypeError("Could not determine name for argument")
raise TypeError("Argument is marked as exposed, but does not have a name.")
if len(decls) == 1:
name = arg = decls[0]
name = name.replace("-", "_").lower()
Expand Down