Skip to content

Commit

Permalink
Add handling of multiple spaces between arguments, improve exception …
Browse files Browse the repository at this point in the history
…text output
  • Loading branch information
yijiano committed Oct 15, 2024
1 parent 2dfed96 commit cd764e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/seedu/pill/exceptions/ExceptionMessages.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package seedu.pill.exceptions;

public enum ExceptionMessages {
INVALID_COMMAND ("Invalid command, please try again."),
INVALID_COMMAND ("Invalid command, please try again.\nType the 'help' command for a list of valid commands."),
SAVE_ERROR ("Error saving to file, please try again."),
LOAD_ERROR ("Error loading saved data"),
INVALID_LINE_FORMAT ("File corrupted. Ignoring invalid line format..."),
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/pill/util/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public Parser(ItemMap items, Storage storage) {
*/
public void parseCommand(String input) {
try {
String[] splitInput = input.split(" ");
String[] splitInput = input.split("\\s+");
if (splitInput.length > 3) {
throw new PillException(ExceptionMessages.TOO_MANY_ARGUMENTS);
}
Expand Down

0 comments on commit cd764e4

Please sign in to comment.