This pull request improves the removeTask method by adding input validation to ensure the task number is within the valid range. It also catches a specific IndexOutOfBoundsException instead of a general Exception, making the code more robust and easier to debug.
Changes:
Added input validation to check if the task number is between 1 and the size of the to-do list
Caught IndexOutOfBoundsException specifically to handle invalid task numbers
Improved error messaging for invalid task numbers
These changes enhance the overall user experience and prevent potential errors when removing tasks from the to-do list.
This pull request improves the
removeTask
method by adding input validation to ensure the task number is within the valid range. It also catches a specificIndexOutOfBoundsException
instead of a generalException
, making the code more robust and easier to debug.Changes:
IndexOutOfBoundsException
specifically to handle invalid task numbersThese changes enhance the overall user experience and prevent potential errors when removing tasks from the to-do list.