Skip to content
This repository has been archived by the owner on Feb 10, 2021. It is now read-only.

Error handling - 404 when id or api endpoint is not found #72

Open
rlskoeser opened this issue Dec 27, 2016 · 2 comments
Open

Error handling - 404 when id or api endpoint is not found #72

rlskoeser opened this issue Dec 27, 2016 · 2 comments

Comments

@rlskoeser
Copy link

On my initial tests, API requests returned 500 errors when no data was loaded; it should have error handling throughout.

  • magazines/id should return a 404 Not Found when the referenced id is not found
  • issues/id should return a 404 Not Found when the referenced id is not found

Any other API endpoints that reference ids should return 404s if the id is not found in the loaded data.

Any requested URL that doesn't match a valid API endpoint should return a 404.

@rlskoeser
Copy link
Author

In some cases, I got empty non-error pages (200 OK) for what I think were invalid urls - that makes it harder to figure out what's going wrong when experimenting with the API. These kinds of urls should either return a 404 or redirect somewhere useful.

@rlskoeser
Copy link
Author

Notes from my last round of testing after updates were made:

  • I'm getting a 204 No Content response for an invalid (nonexistent) constituent id, should be 404 Not Found (while it may be technically true that no content is returned, 20x is a successful status and it would be much more helpful for a consumer to get an indication that there was an error)
  • I'm getting a 400 Bad Request response for an invalid/nonexistent issue or id, should be 404 Not Found (looks like it is coded to return 400 in the xquery module - now that I look, I see this in several places)

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

No branches or pull requests

1 participant