mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
distribution: replace uses of errdefs package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
@@ -91,7 +91,7 @@ func (e unsupportedMediaTypeError) Error() string {
|
||||
// log at info level.
|
||||
func translatePullError(err error, ref reference.Named) error {
|
||||
// FIXME(thaJeztah): cleanup error and context handling in this package, as it's really messy.
|
||||
if errdefs.IsContext(err) {
|
||||
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
|
||||
return err
|
||||
}
|
||||
switch v := err.(type) {
|
||||
@@ -135,7 +135,7 @@ func isNotFound(err error) bool {
|
||||
// as a result of this error.
|
||||
func continueOnError(err error, mirrorEndpoint bool) bool {
|
||||
// FIXME(thaJeztah): cleanup error and context handling in this package, as it's really messy.
|
||||
if errdefs.IsContext(err) {
|
||||
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
|
||||
return false
|
||||
}
|
||||
switch v := err.(type) {
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"github.com/distribution/reference"
|
||||
"github.com/docker/docker/api"
|
||||
"github.com/docker/docker/api/types/events"
|
||||
"github.com/docker/docker/errdefs"
|
||||
refstore "github.com/docker/docker/reference"
|
||||
"github.com/docker/docker/registry"
|
||||
"github.com/opencontainers/go-digest"
|
||||
@@ -134,7 +133,7 @@ func pullEndpoints(ctx context.Context, registryService RegistryResolver, ref re
|
||||
continue
|
||||
}
|
||||
// FIXME(thaJeztah): cleanup error and context handling in this package, as it's really messy.
|
||||
if errdefs.IsContext(err) {
|
||||
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
|
||||
log.G(ctx).WithError(err).Info("Not continuing with pull after error")
|
||||
} else {
|
||||
log.G(ctx).WithError(err).Error("Not continuing with pull after error")
|
||||
|
||||
@@ -4,13 +4,13 @@ import (
|
||||
"bufio"
|
||||
"compress/gzip"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/containerd/log"
|
||||
"github.com/distribution/reference"
|
||||
"github.com/docker/docker/api/types/events"
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/docker/docker/pkg/progress"
|
||||
)
|
||||
|
||||
@@ -72,7 +72,7 @@ func Push(ctx context.Context, ref reference.Named, config *ImagePushConfig) err
|
||||
}
|
||||
|
||||
// FIXME(thaJeztah): cleanup error and context handling in this package, as it's really messy.
|
||||
if errdefs.IsContext(err) {
|
||||
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
|
||||
log.G(ctx).WithError(err).Info("Not continuing with push after error")
|
||||
} else {
|
||||
log.G(ctx).WithError(err).Error("Not continuing with push after error")
|
||||
|
||||
Reference in New Issue
Block a user