tsy24 / pe

0 stars 0 forks source link

Incorrect error message for index 0 #2

Open tsy24 opened 2 years ago

tsy24 commented 2 years ago

When users key in an incorrect index 0, the error message is that the command format is invalid.

Eg. del -s 0

image.png

On the other hand, other invalid index such as 10 which is greater than the size of the current student list gives the invalid index error message.

Eg. del -s 10

image.png

As both are invalid indexes, I believe the error message for index 0 should be the invalid index error message.

nus-pe-bot commented 2 years ago

Team's Response

It is already stated in the first screenshot that the index should be a positive integer, and so this error message does explain why the command was invalid.

Items for the Tester to Verify

:question: Issue response

Team chose [response.Rejected]

Reason for disagreement: As both 0, negative numbers, and numbers greater than the length of the student list are invalid indexes, the error message when the user enters a correct command format with an invalid index should be the same. Thus, del -s 0, del -s -1 and del -s 10 should all throw the same error message, which is the invalid index error message.

While there is some information on the index in the invalid command format error message, the invalid command format message should be thrown only if the user entered a command that does not follow the format, regardless of whether the parameters are valid, eg. del -s or del -s sn/alex yeoh. In del -s 0, the format of the command is correct, so the incorrect command format message should not be thrown. Instead, the more specific invalid index error message should be thrown.