Skip to content

Commit

Permalink
Merge pull request #235 from RCPilot1604/branch-emergency-bugfix
Browse files Browse the repository at this point in the history
Bugfix for incorrect error message
  • Loading branch information
RCPilot1604 authored Nov 12, 2024
2 parents 8d8f676 + e82f2ee commit a931475
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/main/java/tutorlink/command/AddGradeCommand.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package tutorlink.command;

import java.util.ArrayList;
import java.util.List;
import tutorlink.appstate.AppState;
import tutorlink.commons.Commons;
import tutorlink.component.Component;
Expand Down Expand Up @@ -72,7 +74,18 @@ public CommandResult execute(AppState appState, HashMap<String, String> hashmap)
private void validateArguments(String matricNumber, String componentDescription, String scoreNumber)
throws IllegalValueException {
if (matricNumber == null || componentDescription == null || scoreNumber == null) {
throw new IllegalValueException(Commons.ERROR_NULL);
List<String> nullParameters = new ArrayList<>();
if (matricNumber == null) {
nullParameters.add(ARGUMENT_PREFIXES[0]);
}
if (componentDescription == null) {
nullParameters.add(ARGUMENT_PREFIXES[1]);
}
if (scoreNumber == null) {
nullParameters.add(ARGUMENT_PREFIXES[2]);
}
throw new IllegalValueException(String.format(Commons.ERROR_NULL,
String.join(", ", nullParameters)));
}
}

Expand Down

0 comments on commit a931475

Please sign in to comment.