Skip to content

Suggest invoke is more polite with errors. #1034

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion invoke/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
elif isinstance(obj, (Collection, ModuleType)):
method = self.add_collection
else:
raise TypeError("No idea how to insert {!r}!".format(type(obj)))
raise TypeError("Unknown how to insert {!r}.".format(type(obj)))

Check warning on line 123 in invoke/collection.py

View check run for this annotation

Codecov / codecov/patch

invoke/collection.py#L123

Added line #L123 was not covered by tests
method(obj, name=name)

def __repr__(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion invoke/parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def handle(self, token: str) -> None:
else:
if not self.ignore_unknown:
debug("Can't find context named {!r}, erroring".format(token))
self.error("No idea what {!r} is!".format(token))
self.error("Unknown what {!r} is.".format(token))
else:
debug("Bottom-of-handle() see_unknown({!r})".format(token))
self.see_unknown(token)
Expand Down
2 changes: 1 addition & 1 deletion invoke/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ def parse_cleanup(self) -> None:
else:
# TODO: feels real dumb to factor this out of Parser, but...we
# should?
raise ParseError("No idea what '{}' is!".format(halp))
raise ParseError("Unknown what '{}' is.".format(halp))

# Print discovered tasks if necessary
list_root = self.args.list.value # will be True or string
Expand Down
2 changes: 1 addition & 1 deletion sites/docs/concepts/library.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ The result?
integration

$ tester --list
No idea what '--list' is!
Unknown what '--list' is.
$ tester unit
Running unit tests!

Expand Down
6 changes: 3 additions & 3 deletions tests/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def seeks_and_loads_tasks_module_by_default(self):
def does_not_seek_tasks_module_if_namespace_was_given(self):
expect(
"foo",
err="No idea what 'foo' is!\n",
err="Unknown what 'foo' is.\n",
program=Program(namespace=Collection("blank")),
)

Expand Down Expand Up @@ -402,7 +402,7 @@ def ParseErrors_display_message_and_exit_1(self, mock_exit):
# "no idea what foo is!") and exit 1. (Intent is to display that
# info w/o a full traceback, basically.)
stderr = sys.stderr.getvalue()
assert stderr == "No idea what '{}' is!\n".format(nah)
assert stderr == "Unknown what '{}' is.\n".format(nah)
mock_exit.assert_called_with(1)

@trap
Expand Down Expand Up @@ -736,7 +736,7 @@ def exits_after_printing(self):
expect("-c decorators -h punch --list", out=expected)

def complains_if_given_invalid_task_name(self):
expect("-h this", err="No idea what 'this' is!\n")
expect("-h this", err="Unknown what 'this' is.\n")

class task_list:
"--list"
Expand Down