SciCatProject / SciCatProject/backend
Clarify not found error handling when dataset, etc not found
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 27
- Forks
- 37
- Avg merge
- 17h 32m
- Merged PRs (30d)
- 38
Description
Currently, getting a dataset with a given PID returns 200 and an empty body when the dataset does not exist. The same applies to the origdatablocks endpoint. (I didn't test other endpoints.)
In my mind, those should return 404 instead as the requested dataset, etc., does not exist.
Alternatively, we could interpret a 200 response with an empty body as 'object not found'. But this requires that no endpoint (with GET request) returns an empty response that means something other than 'not found'. If we go this route, this behaviour should be documented.
All endpoints should behave the same way, regardless of which solution we go with.
To reproduce, e.g., use this with SciCat deployed from the stable image:
import requests
from urllib.parse import quote_plus
r = requests.get(
url="http://localhost:3000/api/v3/Datasets/" + quote_plus("abcd/123"),
)
print(r)
print(f'"{r.text}"')
prints
<Response [200]>
""
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the GET /api/v3/Datasets/{pid} entry point and compare it with the origdatablocks endpoint using the reproduction request in the issue. Review the other GET endpoints for consistent empty-response behavior, then verify that all endpoints follow the chosen not-found convention and add or update coverage where the project supports it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100