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

Return 404 if project page table doesn't exist #1178

Conversation

cpeel
Copy link
Member

@cpeel cpeel commented Apr 11, 2024

Instead of return a 500 server error, return a 404 if an API call is querying a project's page table that doesn't exist.

# current code returns 500
curl -i -H "Accept: application/json" -H "X-API-KEY: review" \
    -X GET "https://www.pgdp.org/api/v1/projects/projectID4b8bc04f5dc7c/pagedetails"

# new code returns 404
curl -i -H "Accept: application/json" -H "X-API-KEY: review" \
    -X GET "https://www.pgdp.org/~cpeel/c.branch/return-404-for-missing-project-table-api/api/v1/projects/projectID4b8bc04f5dc7c/pagedetails"

This fixes the following API endpoints that use the page table (using an archived project as an example):

/api/v1/projects/projectID4b8bc04f5dc7c/pagedetails
/api/v1/projects/projectID4b8bc04f5dc7c/pages
/api/v1/projects/projectID4b8bc04f5dc7c/pages/001.png/pagerounds/P1

Sandbox: https://www.pgdp.org/~cpeel/c.branch/return-404-for-missing-project-table-api/

Instead of return a 500 server error, return a 404 if an API call
is querying a project's page table that doesn't exist.
@cpeel cpeel requested review from bpfoley, 70ray and srjfoo April 11, 2024 00:02
@cpeel cpeel self-assigned this Apr 11, 2024
@cpeel cpeel merged commit efdd96b into DistributedProofreaders:master Apr 12, 2024
10 checks passed
@cpeel cpeel deleted the return-404-for-missing-project-table-api branch April 12, 2024 16:31
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

Successfully merging this pull request may close these issues.

3 participants