GET /api/events/<id>/category returns 500 for an unknown category id #58
Labels
No labels
bug
chore
data
feature
frontend
good first issue
intermediate
needs/docs
needs/research
needs/upstream
type/bug
type/external
type/feature
type/refactor
urgency
high
urgency
immediate
urgency
low
urgency
medium
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ScottyLabs/cal#58
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What's wrong
The
<id>in this route is a category id, not an event id (/<int:category_id>/category). For an id with no category,get_category_by_id()returns None andcategory_to_dict(None)raises "'NoneType' object has no attribute 'id'", so the route returns 500.How to reproduce
Returns 500
{"error": "Internal server error"}. An existing category id returns 200.Expected
404
{"error": "Category not found"}.Where to look
api/app/api/events.pyget_event_category()(L958-968).api/app/models/category.pyget_category_by_id()andcategory_to_dict().2c5f2e9.Done when
api/tests/api/test_error_responses.pyfor an unknown id (404) andworld["cat1"](200)