Page MenuHomePhabricator

RFC: Return a 404 when returning an empty result set from the Cassandra backend
Closed, InvalidPublic

Description

In RESTBase we generally follow the convention of throwing HTTPErrors whenever a resource is not found. This has made error handling fairly clean and reliable.

However, the restbase cassandra table storage backend does not return a 404 when a query result returns an empty list (items). This is inconsistent with the general expectations about request behavior in RESTBase, and has contributed to subtly buggy error handling as documented in T102117.

I think we should change the API behavior of the table storage backends to return 404 whenever the result list is empty. This will be converted to an HTTPError in RESTBase, and thus conform to the expectations about general request behavior.

Event Timeline

GWicke raised the priority of this task from to High.
GWicke updated the task description. (Show Details)
GWicke subscribed.

Hmmm, I might be wrong on this. Looking at the code, it looks like we already return 404 on empty result set:

status: res.items.length ? 200 : 404,
GWicke claimed this task.

I see 404 in the pageviews API when asking about a title which didn't exist in the requested period; seems expected.