This document describes the various errors that can be returned from an HTTP request to my API.
This was part of the curricular subject's contents:
- When a user or game isn't found
- There can be multiple reasons for this error. It's mostly related to creating a gamee, setting up a board or shooting a shot
When a user tries to access the data of a non-completed game
You are not authorized to do an action regardless of authentication. There can be multiple reasons for this error.. Like inserting a ship type that is not included in the rules or try to shoot when it's not your turn. Joining a game that is already occupied. Trying to quit or shoot a shot on game that you're not part of, etc.
- A request to create a user was made, but the email or name are already in use
- An exception that wasn't checked has occured
When there are type mismatches in request bodies or invalid params or paths in URI's
The request body contains values that are not valid and go against the rules and logic of the game
When there are missing or invalid params
When you make a request using a POST to a path that should be called with a GET per example
"title": "Bad Request: HttpRequestMethodNotSupportedException",
"detail": "Error=org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported",
"objectsInvolved": null,
"type": "https://github.com/isel-leic-daw/2022-daw-leic52d-g05-1/tree/main/docs/problems.md#Body-Error",
"api_path": "/"
"title": "403 FORBIDDEN",
"detail": "Authorization header missing",
"objectsInvolved": null,
"type": "https://github.com/isel-leic-daw/2022-daw-leic52d-g05-1/tree/main/docs/problems.md#Request-Error",
"api_path": "/setup/newgame"
"title": "400 BAD_REQUEST",
"detail": "ShipType doesn't exist. Ship type 'aaaaa' doesn't exist",
"objectsInvolved": null,
"type": "https://github.com/isel-leic-daw/2022-daw-leic52d-g05-1/tree/main/docs/problems.md#Request-Error",
"api_path": "/setup/newgame"
"title": "403 FORBIDDEN",
"detail": "Wrong Password",
"objectsInvolved": null,
"type": "https://github.com/isel-leic-daw/2022-daw-leic52d-g05-1/tree/main/docs/problems.md#Request-Error",
"api_path": "/users/login"
"title": "MethodArgumentNotValidException",
"detail": "Error in the field(s):
{ships[0].head.column: 'null'}, Rejected because -> must not be null;
{ships[0]._isDirectionValid: 'false'}, Rejected because -> Valid values for field 'direction' (not case sensitive) -> UP, LEFT, RIGHT, DOWN;",
"objectsInvolved": null,
"type": "https://github.com/isel-leic-daw/2022-daw-leic52d-g05-1/tree/main/docs/problems.md#Request-Error",
"api_path": "/setup/board"
"title": "Bad Request: HttpMessageNotReadableException",
"detail": "Missing or invalid param, Rejected because -> value failed for JSON property password due to missing (therefore NULL) value for creator parameter 'password' which is a non-nullable type",
"objectsInvolved": null,
"type": "https://github.com/isel-leic-daw/2022-daw-leic52d-g05-1/tree/main/docs/problems.md#Body-Error",
"api_path": "/users/newuser"
"title": "Bad Request: MethodArgumentNotValidException",
"detail": "Error in the field(s): {emailOrName: ' '}, Rejected because -> Fields can't be empty or blank;",
"objectsInvolved": null,
"type": "https://github.com/isel-leic-daw/2022-daw-leic52d-g05-1/tree/main/docs/problems.md#Body-Error",
"api_path": "/users/login"
"title": "403 FORBIDDEN",
"detail": "You Are Not Part Of Any On Going Game",
"objectsInvolved": null,
"type": "https://github.com/isel-leic-daw/2022-daw-leic52d-g05-1/tree/main/docs/problems.md#Request-Error",
"api_path": "/play/quit"
"title": "404 NOT_FOUND",
"detail": "Game doesn't exist",
"objectsInvolved": null,
"type": "https://github.com/isel-leic-daw/2022-daw-leic52d-g05-1/tree/main/docs/problems.md#Request-Error",
"api_path": "/setup/joingame"
"title": "403 FORBIDDEN",
"detail": "You Can No Longer Change Your Board.",
"objectsInvolved": null,
"type": "https://github.com/isel-leic-daw/2022-daw-leic52d-g05-1/tree/main/docs/problems.md#Request-Error",
"api_path": "/setup/board"