Skip to content

Use application specific error codes #95

Description

@skaupper

If a REST endpoint fails to execute successfully it returns a JSON object of the structure

{
    "status": <http_status_code>,
    "error": "<some_error_message>"
}

to the client.

This way the client is able to get more information about the error (except for the status code, which is redundant with the HTTP status code). In order to be somewhat independent of the actual error message the application should provide unique, application specific, status codes which help to better identify the error programmatically.

As an example, the endpoint addTrackToQueue returns with a status code 400 if the requested track already exists in the given queue. Which is fine, but the client cannot distinguish such an AlreadyExists error from a SpotifyBadRequest error.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions