forked from AY2425S1-CS2103T-T14-4/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request AY2425S1-CS2103T-T14-4#148 from ZShunRen/error-dev
Refactor command error messages
- Loading branch information
Showing
13 changed files
with
289 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/seedu/address/commons/util/PrefixCheckResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package seedu.address.commons.util; | ||
|
||
import java.util.List; | ||
|
||
import seedu.address.logic.parser.Prefix; | ||
|
||
/** | ||
* Contains the results of checking for missing prefixes. | ||
*/ | ||
public class PrefixCheckResult { | ||
private final boolean isAllPrefixPresent; | ||
private final List<Prefix> missingPrefixes; | ||
|
||
/** | ||
* Constructs a {@code PrefixCheckResult} object. | ||
* @param isAllPrefixPresent boolean value that is true when all mandatory prefixes are present. | ||
* @param missingPrefixes a {@code List} object that contains all the missing prefixes in the invalid add command. | ||
*/ | ||
public PrefixCheckResult(boolean isAllPrefixPresent, List<Prefix> missingPrefixes) { | ||
this.isAllPrefixPresent = isAllPrefixPresent; | ||
this.missingPrefixes = missingPrefixes; | ||
} | ||
|
||
public boolean isAllPrefixPresent() { | ||
return this.isAllPrefixPresent; | ||
} | ||
|
||
public List<Prefix> getMissingPrefixes() { | ||
return this.missingPrefixes; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,18 +24,22 @@ public class AddCommand extends Command { | |
|
||
public static final String COMMAND_WORD = "add"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a person to the address book. " | ||
+ "Parameters: " | ||
+ PREFIX_NAME + "NAME " | ||
+ PREFIX_PHONE + "PHONE " | ||
+ PREFIX_EMAIL + "EMAIL " | ||
+ PREFIX_ADDRESS + "ADDRESS " | ||
+ PREFIX_JOB + "JOB " | ||
+ PREFIX_INCOME + "INCOME " | ||
+ "[" + PREFIX_TIER + "TIER]...\n" | ||
+ "[" + PREFIX_NEW_REMARK + "NEW REMARK]..." | ||
+ "[" + PREFIX_STATUS + "STATUS]...\n" | ||
+ "Example: " + COMMAND_WORD + " " | ||
public static final String MISSING_PREFIX_MESSAGE_START = "The following mandatory prefixes are missing: "; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a person to the address book.\n" | ||
+ "Required Parameters: " | ||
+ PREFIX_NAME + " NAME " | ||
+ PREFIX_PHONE + " PHONE " | ||
+ PREFIX_EMAIL + " EMAIL " | ||
+ PREFIX_ADDRESS + " ADDRESS " | ||
+ PREFIX_JOB + " JOB " | ||
+ PREFIX_INCOME + " INCOME\n" | ||
+ "Optional Parameters: " | ||
+ "[" + PREFIX_TIER + " TIER] " | ||
+ "[" + PREFIX_NEW_REMARK + " NEW REMARK] " | ||
+ "[" + PREFIX_STATUS + " STATUS] \n" | ||
+ "Example Usage: '" | ||
+ COMMAND_WORD + " " | ||
+ PREFIX_NAME + "John Doe " | ||
+ PREFIX_PHONE + "98765432 " | ||
+ PREFIX_EMAIL + "[email protected] " | ||
|
@@ -44,7 +48,8 @@ public class AddCommand extends Command { | |
+ PREFIX_INCOME + "300 " | ||
+ PREFIX_TIER + "GOLD " | ||
+ PREFIX_NEW_REMARK + "He is very smart " | ||
+ PREFIX_STATUS + "NON_URGENT"; | ||
+ PREFIX_STATUS + "NON_URGENT" | ||
+ "'"; | ||
|
||
public static final String MESSAGE_SUCCESS = "New person added: %1$s"; | ||
public static final String MESSAGE_DUPLICATE_PERSON = "This person already exists in the address book"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,20 +44,21 @@ public class EditCommand extends Command { | |
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits the details of the person identified " | ||
+ "by the index number used in the displayed person list. " | ||
+ "Existing values will be overwritten by the input values. Any fields unspecified will not be modified.\n" | ||
+ "Parameters: INDEX (must be a positive integer) " | ||
+ "[" + PREFIX_NAME + "NAME] " | ||
+ "[" + PREFIX_PHONE + "PHONE] " | ||
+ "[" + PREFIX_EMAIL + "EMAIL] " | ||
+ "[" + PREFIX_ADDRESS + "ADDRESS] " | ||
+ "[" + PREFIX_JOB + "JOB] " | ||
+ "[" + PREFIX_INCOME + "INCOME] " | ||
+ "[" + PREFIX_TIER + "TIER]...\n" | ||
+ "[" + PREFIX_NEW_REMARK + "NEW REMARK] " | ||
+ "[" + PREFIX_APPEND_REMARK + "ADD-ON TO EXISTING REMARK] " | ||
+ "[" + PREFIX_STATUS + "STATUS] " | ||
+ "Example: " + COMMAND_WORD + " 1 " | ||
+ "Required Parameters: INDEX (must be a positive integer)\n" | ||
+ "Optional Parameters: " | ||
+ "[" + PREFIX_NAME + " NAME] " | ||
+ "[" + PREFIX_PHONE + " PHONE] " | ||
+ "[" + PREFIX_EMAIL + " EMAIL] " | ||
+ "[" + PREFIX_ADDRESS + " ADDRESS] " | ||
+ "[" + PREFIX_JOB + " JOB] " | ||
+ "[" + PREFIX_INCOME + " INCOME] " | ||
+ "[" + PREFIX_TIER + " TIER] " | ||
+ "[" + PREFIX_NEW_REMARK + " NEW REMARK] " | ||
+ "[" + PREFIX_APPEND_REMARK + " ADD-ON TO EXISTING REMARK] " | ||
+ "[" + PREFIX_STATUS + " STATUS] \n" | ||
+ "Example Usage: '" + COMMAND_WORD + " 1 " | ||
+ PREFIX_PHONE + "91234567 " | ||
+ PREFIX_EMAIL + "[email protected]"; | ||
+ PREFIX_EMAIL + "[email protected]'"; | ||
|
||
public static final String MESSAGE_EDIT_PERSON_SUCCESS = "Edited Person: %1$s"; | ||
public static final String MESSAGE_NOT_EDITED = "At least one field to edit must be provided."; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.