Browse code

daemon/c8d: Log correct error extractOCIErrors

When logging an unmarshal failure in the registry error handling code,
the function was incorrectly logging the uninitialized `derrs` variable
instead of the actual JSON unmarshal error `jerr`.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>

Paweł Gronowski authored on 2025/12/15 23:56:44
Showing 1 changed files
... ...
@@ -26,7 +26,7 @@ func translateRegistryError(ctx context.Context, err error) error {
26 26
 		var derr docker.Error
27 27
 		if errors.As(err, &remoteErr) {
28 28
 			if jerr := json.Unmarshal(remoteErr.Body, &derrs); jerr != nil {
29
-				log.G(ctx).WithError(derrs).Debug("unable to unmarshal registry error")
29
+				log.G(ctx).WithError(jerr).Debug("unable to unmarshal registry error")
30 30
 				return fmt.Errorf("%w: %w", cerrdefs.ErrUnknown, err)
31 31
 			}
32 32
 			if len(derrs) == 0 && (remoteErr.StatusCode == http.StatusUnauthorized || remoteErr.StatusCode == http.StatusForbidden) {