SpaceTradersAPI / issues-and-suggestions

16 stars 1 forks source link

Consistent error responses #4

Closed jadlers closed 3 years ago

jadlers commented 3 years ago

Henchman lifted on Discord that there are two different structures for responses with errors (see examples below).

All error responses should follow the same structure in order to make handling them easier.

With an invalid URL

{
    "error": {
        "code": 404,
        "message": "This route does not exist. Did you type the route correctly? Most route resources are plural."
    }
}

Getting a restricted URL without a token

{
    "error": "AuthError: Invalid Token",
    "message": "Did you forget to add a bearer token to your request?"
}