diff --git a/src/main/java/command/Command.java b/src/main/java/command/Command.java index 6f35d5f9b8..c0c48c47b6 100644 --- a/src/main/java/command/Command.java +++ b/src/main/java/command/Command.java @@ -37,7 +37,7 @@ public static int getTaskNumberFromMessage(String message) throws InvalidTaskNum public static void validateDescriptionNotEmpty(CommandTypeEnum commandType, String description) throws MissingCommandDescriptionException { if (description.isEmpty()) { - throw new MissingCommandDescriptionException(commandType.toString()); + throw new MissingCommandDescriptionException(commandType); } } diff --git a/src/main/java/exception/MissingCommandDescriptionException.java b/src/main/java/exception/MissingCommandDescriptionException.java index a27f1fd3ae..f5664f2c06 100644 --- a/src/main/java/exception/MissingCommandDescriptionException.java +++ b/src/main/java/exception/MissingCommandDescriptionException.java @@ -1,5 +1,7 @@ package exception; +import type.CommandTypeEnum; + /** * Encapsulates an exception when a user inputs a command with an empty description, * but the command requires a description. @@ -10,10 +12,11 @@ public class MissingCommandDescriptionException extends DukeException { * * @param commandType Command type. */ - public MissingCommandDescriptionException(String commandType) { + public MissingCommandDescriptionException(CommandTypeEnum commandType) { super(String.format( - "The description of a %s command cannot be empty", - commandType + "The description of a %s command cannot be empty. Please enter the command in this format: %s", + commandType.toString(), + commandType.getFormat() )); } }