Akavall / GoGamesProject

Trying to make some simple games using golang.
1 stars 1 forks source link

Improve query string parsing and error handling in basic_server.go #31

Open a-temlyakov opened 9 years ago

a-temlyakov commented 9 years ago

Currently is a bit ad-hoc... there is the parse_input method (https://github.com/Akavall/GoGamesProject/blob/master/basic_server.go#L215), but it's currently only used by the take_zombie_dice_turn method.

I am certain there are libraries out there we can use, but I had rather do it ourselves as a learning exercise. Just need to clean up (abstract away) the parsing a bit and all the error handling that results from it.

My general idea right now would be to just move the parsing to method(s) like parse_input and then when error handling instead of checking at each parameter collect the errors and check them all in one go after all parsing is done. Can get more ideas from this: https://blog.golang.org/errors-are-values

Akavall commented 9 years ago

I think this makes sense :).