Missing error types
Situation
I noticed that some situations that should create an error do not have a defined error. Therefore, I want to propose adding some errors to the protocol.
Proposed Solution
Adding the following errors to the protocol:
-
E012
- Client has already announced themselves -
E013
- Client has not yet announced themselves -
E014
- Client is not in a game -
E015
- Game already started
These will be returned in the following situations:
E012
: A client sends an ANNOUNCE
message, while they already sent a succesful ANNOUNCE
before. (Note: if a client sends an ANNOUNCE
, gets returned an error, and then resends their ANNOUNCE
, this error should not be returned. That is a valid case, if a client uses a name that is already taken, they should be able to do another ANNOUNCE
).
E013
: A client tries to request a game when they have not yet announced themselves. For example, client A connects to server. Then, when client A sends REQUESTGAME
, the server should return E013
, because the client should first announce themselves.
E014
: A client tries to send a game-related message (MAKEMOVE
), while not being in a game. This can be because the client has not requested a game yet, or because the game did not start yet and the client is still in the queue. In these cases, the server will return E014
to a MAKEMOVE
message.
E015
: The game has already started. This is an error that will only be sent by servers that do not support the multi-game feature. Whenever a client sends REQUESTGAME
, but there already is an ongoing game, the server will reply with E015
.
Alternative Solution
An alternative solution to adding these errors would be to create one generic error, E000
, which has another argument, namely an error message/description, that can then be shown on the UI. Since most people wanted to go for relatively specific errors during the protocol session, and hence this protocol already has some quite specific errors, I thought it would fit best to add some more of those, instead of adding one generic error. However, I wanted to mention this solution as well for completeness.
Conclusion
Make sure to leave feedback below if you have any. Due to the nearing deadlines, I want to close this issue by tomorrow (27-01-2022) 12:00.