Skip to content

Commit

Permalink
[#5825] improvement(CLI): Update the error message for creating a met…
Browse files Browse the repository at this point in the history
…alake when the required parameter is missing.

Currently, when a metalake is created without specifying the metalake argument, the message "Cannot parse a null or empty identifier" is displayed. This message is unclear and lacks helpful guidance for the user. Update the message to: "! metalake is not defined" to make it more user-friendly and informative.

fix some change
  • Loading branch information
Abyss-lord committed Dec 15, 2024
1 parent b151461 commit 2cbcf1d
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Map;
import java.util.Objects;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.gravitino.MetadataObject;
import org.apache.gravitino.cli.commands.Command;

/* Gravitino Command line */
Expand Down Expand Up @@ -174,6 +176,10 @@ private void handleMetalakeCommand() {
} else if (CommandActions.LIST.equals(command)) {
newListMetalakes(url, ignore, outputFormat).handle();
} else if (CommandActions.CREATE.equals(command)) {
if (Objects.isNull(metalake)) {
System.err.println("! " + MetadataObject.Type.METALAKE.name() + " is not defined");
return;
}
String comment = line.getOptionValue(GravitinoOptions.COMMENT);
newCreateMetalake(url, ignore, metalake, comment).handle();
} else if (CommandActions.DELETE.equals(command)) {
Expand Down

0 comments on commit 2cbcf1d

Please sign in to comment.