nus-cs2103-AY2021S1 / pe-dev-response

0 stars 0 forks source link

Same error leading to different error message #5640

Open nus-pe-bot opened 4 years ago

nus-pe-bot commented 4 years ago

Steps to replicate:

  1. Ensure the glossary has x items. In this case, it only has 4 items.
  2. input edit 0 d/easy
  3. input edit 5 d/easy (or x+1)

The same index out of bounds error result in different error message shown.

(for step 2) image.png

(for step 3) image.png


[original: nus-cs2103-AY2021S1/pe-interim#5588]

kswk commented 4 years ago

Team's Response

These two error cases are different, therefore it is justified to use different error messages.

In the first case: input edit 0 d/easy, the invalid command format error was shown as the parameter 0 is not a positive integer. 0 will always be an invalid input, because the list does not start from 0. Therefore, a more descriptive error message is needed to remind users of the accepted command format.

In the second case: input edit 5 d/easy, the invalid flashcard index error was shown because there are only 4 flashcards in the glossary but the user tried to edit the 5th flashcard. The command format is still valid (since the integer entered is positive), but the index itself is not in this case because the list contains less than 5 flashcards.

The first case reflects an invalid command format error, the second case reflects an invalid index error. The error messages are differentiated based on these cases.

Duplicate status (if any):

--