Page MenuHomePhabricator

Design/Feature discussion: return codes for LW services to signal "the revision doesn't exist"
Open, Needs TriagePublic

Description

Currently, if the client requests a score for a non-existant revision, we return a rather generic 400 status code, which makes it fall into the same bucket as many other errors/responses that are not semantically but syntactically "bad" (e.g. malformed JSON in the request.

I think we should discuss if there is a better code we can use. Some codes are "well-known": https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_client_errors

The 4xx series is definitely the range we should be in, as it is defined as "client errors", i.e. neither successful (2xx), nor a redirect (3xx), nor a server-side error (5xx), nor just informational (1xx).

404 we can't easily use since LW and the API GW use it to signal "this model does not exist". Many of the other 4xx series codes sound likely would match, but are actually very specific errors related to WebDAV and similar tech ontop of HTTP.

One close-ish match I found is 422:

422 Unprocessable Entity - The request was well-formed but was unable to be followed due to semantic errors.