nus-cs2113-AY2122S1 / pe-dev-response

0 stars 0 forks source link

Error message not suitable for view command #2960

Open nus-se-bot opened 2 years ago

nus-se-bot commented 2 years ago

image.png

When the user types 'view -1111111' , the user would get the error message that an instrument does not exist at that index when in reality the index is invalid. Needs a more appropriate error message.


[original: nus-cs2113-AY2122S1/pe-interim#2952] [original labels: severity.Medium type.FunctionalityBug]

theodorekwok commented 2 years ago

Team's Response

Similar to #2961, the input index is negative so this is a duplicate according to the forum excerpt "Multiple buggy behaviors that are actually caused by the same defect and cannot be fixed independently." To fix both issues, we need to correct the getAndValidateIndexNumber() method.

We agree that in Java all index numbers of ArrayLists and Arrays must be non-negative. Since we had used an ArrayList to store the added instruments in the program, -1111 should be an invalid index instead of being treated as a legitimate index with no element at that index, like it is portrayed in the error message. So, the reported bug is accepted.

Severity is downgraded to Low since the bug only has to do with phrasing of the error message but the feature works as expected.

Duplicate status (if any):

Duplicate of #2961