Skip to content

Commit

Permalink
Merge pull request #207 from CJerrong/fix-logAdd
Browse files Browse the repository at this point in the history
Fix exception messages displaying wrong information
  • Loading branch information
gerteck authored Apr 15, 2024
2 parents ead3de5 + 41539d4 commit dfdb87d
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class LogAddCommand extends Command {
+ PREFIX_REMARKS + "was a good session ";

public static final String MESSAGE_SUCCESS = "New log added!";
public static final String MESSAGE_NEGATIVE_DURATION = "Duration cannot be negative.";
public static final String MESSAGE_NEGATIVE_DURATION = "Duration must be positive.";
public static final String MESSAGE_PERSONS_NOT_PAIRED = "The volunteer and befriendee are not paired.";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class LogEditCommand extends Command {

public static final String MESSAGE_EDIT_LOG_SUCCESS = "Edited Log successfully: %1$s";
public static final String MESSAGE_NOT_EDITED = "At least one field to edit must be provided.";
public static final String MESSAGE_NEGATIVE_DURATION = "Duration cannot be negative.";
public static final String MESSAGE_NEGATIVE_DURATION = "Duration must be positive.";

private final Index index;
private final EditLogDescriptor editLogDescriptor;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/scrolls/elder/logic/parser/ParserUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public static Integer parseInt(String num) throws ParseException {
try {
return Integer.parseInt(trimmedNum);
} catch (NumberFormatException e) {
throw new ParseException("Invalid number format. Expected a number.", e);
throw new ParseException("Invalid number format. Expected an integer.", e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void parse_invalidDateFormat_throwsParseException() {
@Test
public void parse_invalidDurationFormat_throwsParseException() {
assertParseFailure(parser, "1 2 t/Movies s/2024-03-07 d/Two r/Good",
"Invalid number format. Expected a number.");
"Invalid number format. Expected an integer.");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void parse_invalidDateFormat_throwsParseException() {
@Test
public void parse_invalidDurationFormat_throwsParseException() {
assertParseFailure(parser, "1 t/Icebreaker s/2024-04-08 d/Two r/Was okay.",
"Invalid number format. Expected a number.");
"Invalid number format. Expected an integer.");
}
@Test
public void parse_invalidArgs_throwsParseException() {
Expand Down

0 comments on commit dfdb87d

Please sign in to comment.