Skip to content

Feat/registry error status - #335

Open
sjalloq wants to merge 2 commits into
oras-project:mainfrom
sjalloq:feat/registry-error-status
Open

sjalloq wants to merge 2 commits into
oras-project:mainfrom
sjalloq:feat/registry-error-status

Conversation

@sjalloq

@sjalloq sjalloq commented Nov 30, 2026

Copy link
Copy Markdown

This is the "one field" fix for #334. OciDistributionError::RegistryError now holds the HTTP status code of the response, in a new code: u16 field, and its message prints it.

…error document

A 4xx response whose body is an OCI error document becomes a RegistryError,
which holds the error codes and the URL. One test pins that the error codes
reach the caller. The other expects the HTTP status code in the message and is
ignored, because RegistryError does not hold the status code yet.

Signed-off-by: Shareef Jalloq <shareef@jalloq.co.uk>
A 4xx response whose body is an OCI error document became a RegistryError
with the error codes and the URL, and the status code was lost. A caller
could not tell a 403 from a 404 or a 429 without reading the error codes.

RegistryError now holds the status code in a code field, as ServerError
does, and its message includes it.

BREAKING CHANGE: OciDistributionError::RegistryError has a new field, code.
Code that constructs the variant, or that matches it without `..`, needs
to be updated.

Signed-off-by: Shareef Jalloq <shareef@jalloq.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant