I'm making a Tic-Tac-Toe game for an assignment and I am new to C#. I have a custom exception for bad moves called BadMoveException
, which would be if the user enters anything other than 0-8. There is existing code for the assignment and I'm wondering if I should do away with the code to create my own to use this exception or if it is easy enough to implement here? Here is the code:
string input;
int position;
do
{
input = Console.ReadLine();
}
while (!int.TryParse(input, out position));
I need to catch the BadMoveException
, and any others with an unknown error message. Thank you in advance!