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

Be more specific about which command is missing when throwing an exception #1125

Merged
merged 1 commit into from
Dec 10, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,17 @@ public Map<String, String> commandAliases() {
@SuppressWarnings("unchecked")
public <V extends Enum<V>> void rename(V command, String newName) {
if (nameCommand.containsKey(newName)) {
throw new IllegalArgumentException("Duplicate command name!");
throw new IllegalArgumentException("Duplicate command name '" + command + "'!");
} else if (!commandName.containsKey(command)) {
throw new IllegalArgumentException("Command does not exists!");
throw new IllegalArgumentException("Command '" + command + "' does not exists!");
}
commandName.put((T) command, newName);
doNameCommand();
}

public void alias(String alias, String command) {
if (!nameCommand.containsKey(command)) {
throw new IllegalArgumentException("Command does not exists!");
throw new IllegalArgumentException("Command '" + command + "' does not exists!");
}
aliasCommand.put(alias, command);
}
Expand All @@ -198,7 +198,7 @@ public T command(String name) {
if (nameCommand.containsKey(name)) {
out = nameCommand.get(name);
} else {
throw new IllegalArgumentException("Command does not exists!");
throw new IllegalArgumentException("Command '" + name + "' does not exists!");
}
return out;
}
Expand Down Expand Up @@ -230,7 +230,7 @@ public <V extends Enum<V>> void rename(V command, String newName) {

public void alias(String alias, String command) {
if (!commandExecute.containsKey(command)) {
throw new IllegalArgumentException("Command does not exists!");
throw new IllegalArgumentException("Command '" + command + "' does not exists!");
}
aliasCommand.put(alias, command);
}
Expand Down
Loading