-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ociregistry: improve errors with respect to HTTP status
Currently the standard wire representation of an error is duplicated across both client and server, and there is no way for: - a client to access the actual HTTP status of a response - an `Interface` implementation to cause the `ociserver` to return a specific HTTP error code for a error code that it doesn't know about. This change addresses that by moving the wire representation into the top level `ociregistry` package, splitting `HTTPError` into its own type, and making both `ociclient` and `ociserver` aware of them. One deliberate decision made here guards against some scenarios when nesting an `ociclient` implementation inside `ociserver`. There is a risk that, due to the fact we're using the same `HTTPError` in `httpclient` and `httpserve, if `ociclient` talks to a misbehaving server that returns inappropriate HTTP response codes, those codes could propagate back through `ociserver`, causing that to return inappropriate codes too. So in `ociserver` we only use the `HTTPError` code if there is no known HTTP status for the error code. This seems like a reasonable half-way-house compromise. Fixes #26. Signed-off-by: Roger Peppe <[email protected]> Change-Id: I5a79c1c6fec9f22c1f565830d73486b406dd181d
- Loading branch information
Showing
8 changed files
with
396 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.