Replace errors.Cause() with errors.Is()
Dependencies may be switching to use the new `%w` formatting option to wrap errors; switching to use `errors.Is()` makes sure that we are still able to unwrap the error and detect the underlying cause. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -64,7 +64,7 @@ func Handlers(handlers ...Handler) HandlerFunc {
|
||||
for _, handler := range handlers {
|
||||
ch, err := handler.Handle(ctx, desc)
|
||||
if err != nil {
|
||||
if errors.Cause(err) == ErrStopHandler {
|
||||
if errors.Is(err, ErrStopHandler) {
|
||||
break
|
||||
}
|
||||
return nil, err
|
||||
@@ -87,7 +87,7 @@ func Walk(ctx context.Context, handler Handler, descs ...ocispec.Descriptor) err
|
||||
|
||||
children, err := handler.Handle(ctx, desc)
|
||||
if err != nil {
|
||||
if errors.Cause(err) == ErrSkipDesc {
|
||||
if errors.Is(err, ErrSkipDesc) {
|
||||
continue // don't traverse the children.
|
||||
}
|
||||
return err
|
||||
@@ -136,7 +136,7 @@ func Dispatch(ctx context.Context, handler Handler, limiter *semaphore.Weighted,
|
||||
limiter.Release(1)
|
||||
}
|
||||
if err != nil {
|
||||
if errors.Cause(err) == ErrSkipDesc {
|
||||
if errors.Is(err, ErrSkipDesc) {
|
||||
return nil // don't traverse the children.
|
||||
}
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user