distribution-spec
distribution-spec copied to clipboard
proposal: add error code QUOTA_EXCEEDED
The list of error codes contains some quite broad categories like DENIED, but also a lot of very specific errors. Are you all generally interested in extending this list as new needs arise in alternative implementations of the API? Or should implementations just choose the most appropriate pre-existing error code?
If there is interest, I propose the addition of an error code QUOTA_EXCEEDED which can be returned from any PUT, PATCH or POST operation. Right now, I'm using DENIED for this (example), but only because DENIED is the most generic of the existing error codes.
If there is interest in adding the new error code, I'll prepare a PR after the holidays.
One of the examples uses DENIED with a 429 (which is what I've done too).
It seems to me that the HTTP status code is expressive enough for this, what do you think?
Quota implies authorization, which is generally out of scope for this iteration. However:
Authentication and authorization support: While authentication and authorization
support will influence this specification, those details MAY be left to a future
specification. However, relevant header definitions and **error codes are
present to provide an indication of what a client MAY encounter.**
So if there is a widely used and agreed upon error code that clients MAY encounter, I think it is beneficial to bring it forward.
The other part of the spec outlining importance of getting this right and not backtracking:
While the client can take action on certain error codes, **the registry MAY add new
error codes over time**. All client implementations SHOULD treat unknown error codes
as UNKNOWN, allowing future error codes to be added without breaking API
compatibility. **For the purposes of the specification error codes will only be
added and never removed.**
I think this error code makes sense - example: "Your account allows for only 100 images, and you tried to push number 101"
While quotas make sense, we don't really have quotas in the spec, so it would be weird to add error codes for them.
We could open up the error codes to allow custom errors.