Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid weapon choice does not return easily understandable error message in body #3

Open
techcoachralph opened this issue Dec 4, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@techcoachralph
Copy link
Collaborator

Summary:

When a user passes an invalid weapon choice, I want a clear error message so the user can know what their options for weapons are as opposed to an enum choice.

Expected Results:

{
    "error_message": "You entered the weapon choice of "ax". You can only choose from "ROCK, PAPER, or SCISSORS as a weapon".
}

Actual Results:

Error message doesn't clearly express how I can provide a correct request.

    "detail": [
        {
            "type": "enum",
            "loc": [
                "body",
                "choice"
            ],
            "msg": "Input should be 1, 2 or 3",
            "input": "ax",
            "ctx": {
                "expected": "1, 2 or 3"
            }
        }
    ]
}

Steps to Reproduce:

Endpoint: http://localhost:8080/api/play
Method: POST
Request Body:

{
  "choice":"ax"
}

Environments:

locally via docker

@techcoachralph techcoachralph added the enhancement New feature or request label Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant