deeper-blue / negativei2-server

The server for Deeper Blue, an assistive chess-playing robot. Developed for the System Design Project, a 3rd year course offered at the School of Informatics, University of Edinburgh.
Other
3 stars 0 forks source link

Internal error on set AI as both players #61

Closed notexactlyawe closed 5 years ago

notexactlyawe commented 5 years ago

Currently the server returns a HTTP code of 500 when you try to create a game with an AI playing an AI. This should be disallowed, but should return a 400 Bad Request instead of erroring. Logs for this are below:

2019-04-02T13:55:12.833828+00:00 heroku[router]: at=info method=GET path="/socket.io/?EIO,3&transport,websocket&sid,a5ee56969f3b4f8c9fdccbc960623fcb" host=negativei2-server.herokuapp.com request_id=71be2c21-f330-4fc1-8122-e17018c24750 fwd="192.41.131.252" dyno=web.1 connect=0ms service=61297ms status=101 bytes=175 protocol=https
2019-04-02T13:55:38.706893+00:00 app[web.1]: [2019-04-02 13:55:38 +0000] [10] [ERROR] Exception on /creategame [POST]
2019-04-02T13:55:38.706917+00:00 app[web.1]: Traceback (most recent call last):
2019-04-02T13:55:38.706933+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
2019-04-02T13:55:38.706935+00:00 app[web.1]: response = self.full_dispatch_request()
2019-04-02T13:55:38.706936+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request
2019-04-02T13:55:38.706937+00:00 app[web.1]: rv = self.handle_user_exception(e)
2019-04-02T13:55:38.706939+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/flask_cors/extension.py", line 161, in wrapped_function
2019-04-02T13:55:38.706940+00:00 app[web.1]: return cors_after_request(app.make_response(f(*args, **kwargs)))
2019-04-02T13:55:38.706941+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception
2019-04-02T13:55:38.706942+00:00 app[web.1]: reraise(exc_type, exc_value, tb)
2019-04-02T13:55:38.706944+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
2019-04-02T13:55:38.706945+00:00 app[web.1]: raise value
2019-04-02T13:55:38.706946+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
2019-04-02T13:55:38.706948+00:00 app[web.1]: rv = self.dispatch_request()
2019-04-02T13:55:38.706949+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
2019-04-02T13:55:38.706951+00:00 app[web.1]: return self.view_functions[rule.endpoint](**req.view_args)
2019-04-02T13:55:38.706952+00:00 app[web.1]: File "/app/server/server.py", line 110, in create_game
2019-04-02T13:55:38.706953+00:00 app[web.1]: game = Game.from_create_game_schema(request.form, doc_ref.id)
2019-04-02T13:55:38.706954+00:00 app[web.1]: File "/app/server/game.py", line 644, in from_create_game_schema
2019-04-02T13:55:38.706955+00:00 app[web.1]: game.add_player(input_dict['player2_id'], BLACK)
2019-04-02T13:55:38.706957+00:00 app[web.1]: File "/app/server/game.py", line 449, in add_player
2019-04-02T13:55:38.706958+00:00 app[web.1]: raise RuntimeError(f"Cannot have the same ID '{id_}' as player on other side '{self._invert(side)}'.")
2019-04-02T13:55:38.706965+00:00 app[web.1]: RuntimeError: Cannot have the same ID 'AI' as player on other side 'w'.
2019-04-02T13:55:38.708439+00:00 app[web.1]: 10.39.172.94 - - [02/Apr/2019:13:55:38 +0000] "POST /creategame HTTP/1.1" 500 291 "https://deeper-blue.me/create" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0"