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

Use application specific error codes #95

Open
skaupper opened this issue Feb 15, 2020 · 0 comments
Open

Use application specific error codes #95

skaupper opened this issue Feb 15, 2020 · 0 comments

Comments

@skaupper
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant