feat: replace github.com/pkg/errors to errors
Signed-off-by: haoyun <yun.hao@daocloud.io> Co-authored-by: zounengren <zouyee1989@gmail.com>
This commit is contained in:
8
task.go
8
task.go
@@ -20,6 +20,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
goruntime "runtime"
|
||||
@@ -46,7 +47,6 @@ import (
|
||||
is "github.com/opencontainers/image-spec/specs-go"
|
||||
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// UnknownExitStatus is returned when containerd is unable to
|
||||
@@ -312,7 +312,7 @@ func (t *task) Delete(ctx context.Context, opts ...ProcessDeleteOpts) (*ExitStat
|
||||
}
|
||||
fallthrough
|
||||
default:
|
||||
return nil, errors.Wrapf(errdefs.ErrFailedPrecondition, "task must be stopped before deletion: %s", status.Status)
|
||||
return nil, fmt.Errorf("task must be stopped before deletion: %s: %w", status.Status, errdefs.ErrFailedPrecondition)
|
||||
}
|
||||
if t.io != nil {
|
||||
t.io.Close()
|
||||
@@ -334,7 +334,7 @@ func (t *task) Delete(ctx context.Context, opts ...ProcessDeleteOpts) (*ExitStat
|
||||
|
||||
func (t *task) Exec(ctx context.Context, id string, spec *specs.Process, ioCreate cio.Creator) (_ Process, err error) {
|
||||
if id == "" {
|
||||
return nil, errors.Wrapf(errdefs.ErrInvalidArgument, "exec id must not be empty")
|
||||
return nil, fmt.Errorf("exec id must not be empty: %w", errdefs.ErrInvalidArgument)
|
||||
}
|
||||
i, err := ioCreate(id)
|
||||
if err != nil {
|
||||
@@ -555,7 +555,7 @@ func (t *task) LoadProcess(ctx context.Context, id string, ioAttach cio.Attach)
|
||||
if err != nil {
|
||||
err = errdefs.FromGRPC(err)
|
||||
if errdefs.IsNotFound(err) {
|
||||
return nil, errors.Wrapf(err, "no running process found")
|
||||
return nil, fmt.Errorf("no running process found: %w", err)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user