Rules cli stops if a snake returns invalid response #205
jlafayette
started this conversation in
Feature Requests
Replies: 2 comments 1 reply
-
I like this idea, thanks for detailing it. For reference, I believe the relevant code is here: Interestingly I don't think there's actually a check for 200 OK... |
Beta Was this translation helpful? Give feedback.
0 replies
-
I opened a PR to address this: BattlesnakeOfficial/rules#95
I noticed that too... with my proposed change it checks for 200 status code and does some other validation on the JSON and move string. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently if a snake returns a response with invalid JSON, the game will exit immediately with an error like this:
I'm hoping that we could match the behavior of the official game engine in these cases and have the snake continue in the direction of it's last move.
Also I think it would be helpful to show a warning message with more details to help debugging - including the body would be especially helpful, since that often contains an error message. For example, this is an out of bounds error from biter:
In cases where the StatusCode is 200, but the body is not a valid JSON, it could show something like this:
If the JSON is valid but the move is not, then it could show what the valid options are:
Beta Was this translation helpful? Give feedback.
All reactions