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:
@@ -21,11 +21,12 @@ package process
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/containerd/console"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
google_protobuf "github.com/gogo/protobuf/types"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type deletedState struct {
|
||||
@@ -56,11 +57,11 @@ func (s *deletedState) Start(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func (s *deletedState) Delete(ctx context.Context) error {
|
||||
return errors.Wrap(errdefs.ErrNotFound, "cannot delete a deleted process")
|
||||
return fmt.Errorf("cannot delete a deleted process: %w", errdefs.ErrNotFound)
|
||||
}
|
||||
|
||||
func (s *deletedState) Kill(ctx context.Context, sig uint32, all bool) error {
|
||||
return errors.Wrap(errdefs.ErrNotFound, "cannot kill a deleted process")
|
||||
return fmt.Errorf("cannot kill a deleted process: %w", errdefs.ErrNotFound)
|
||||
}
|
||||
|
||||
func (s *deletedState) SetExited(status int) {
|
||||
|
@@ -37,7 +37,6 @@ import (
|
||||
"github.com/containerd/fifo"
|
||||
runc "github.com/containerd/go-runc"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type execProcess struct {
|
||||
@@ -146,12 +145,12 @@ func (e *execProcess) kill(ctx context.Context, sig uint32, _ bool) error {
|
||||
pid := e.pid.get()
|
||||
switch {
|
||||
case pid == 0:
|
||||
return errors.Wrap(errdefs.ErrFailedPrecondition, "process not created")
|
||||
return fmt.Errorf("process not created: %w", errdefs.ErrFailedPrecondition)
|
||||
case !e.exited.IsZero():
|
||||
return errors.Wrapf(errdefs.ErrNotFound, "process already finished")
|
||||
return fmt.Errorf("process already finished: %w", errdefs.ErrNotFound)
|
||||
default:
|
||||
if err := unix.Kill(pid, syscall.Signal(sig)); err != nil {
|
||||
return errors.Wrapf(checkKillError(err), "exec kill error")
|
||||
return fmt.Errorf("exec kill error: %w", checkKillError(err))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -187,12 +186,12 @@ func (e *execProcess) start(ctx context.Context) (err error) {
|
||||
)
|
||||
if e.stdio.Terminal {
|
||||
if socket, err = runc.NewTempConsoleSocket(); err != nil {
|
||||
return errors.Wrap(err, "failed to create runc console socket")
|
||||
return fmt.Errorf("failed to create runc console socket: %w", err)
|
||||
}
|
||||
defer socket.Close()
|
||||
} else {
|
||||
if pio, err = createIO(ctx, e.id, e.parent.IoUID, e.parent.IoGID, e.stdio); err != nil {
|
||||
return errors.Wrap(err, "failed to create init process I/O")
|
||||
return fmt.Errorf("failed to create init process I/O: %w", err)
|
||||
}
|
||||
e.io = pio
|
||||
}
|
||||
@@ -220,19 +219,19 @@ func (e *execProcess) start(ctx context.Context) (err error) {
|
||||
if socket != nil {
|
||||
console, err := socket.ReceiveMaster()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to retrieve console master")
|
||||
return fmt.Errorf("failed to retrieve console master: %w", err)
|
||||
}
|
||||
if e.console, err = e.parent.Platform.CopyConsole(ctx, console, e.id, e.stdio.Stdin, e.stdio.Stdout, e.stdio.Stderr, &e.wg); err != nil {
|
||||
return errors.Wrap(err, "failed to start console copy")
|
||||
return fmt.Errorf("failed to start console copy: %w", err)
|
||||
}
|
||||
} else {
|
||||
if err := pio.Copy(ctx, &e.wg); err != nil {
|
||||
return errors.Wrap(err, "failed to start io pipe copy")
|
||||
return fmt.Errorf("failed to start io pipe copy: %w", err)
|
||||
}
|
||||
}
|
||||
pid, err := pidFile.Read()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to retrieve OCI runtime exec pid")
|
||||
return fmt.Errorf("failed to retrieve OCI runtime exec pi: %wd", err)
|
||||
}
|
||||
e.pid.pid = pid
|
||||
return nil
|
||||
@@ -241,7 +240,7 @@ func (e *execProcess) start(ctx context.Context) (err error) {
|
||||
func (e *execProcess) openStdin(path string) error {
|
||||
sc, err := fifo.OpenFifo(context.Background(), path, syscall.O_WRONLY|syscall.O_NONBLOCK, 0)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to open stdin fifo %s", path)
|
||||
return fmt.Errorf("failed to open stdin fifo %s: %w", path, err)
|
||||
}
|
||||
e.stdin = sc
|
||||
e.closers = append(e.closers, sc)
|
||||
|
@@ -21,9 +21,10 @@ package process
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/containerd/console"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type execState interface {
|
||||
@@ -48,7 +49,7 @@ func (s *execCreatedState) transition(name string) error {
|
||||
case "deleted":
|
||||
s.p.execState = &deletedState{}
|
||||
default:
|
||||
return errors.Errorf("invalid state transition %q to %q", stateName(s), name)
|
||||
return fmt.Errorf("invalid state transition %q to %q", stateName(s), name)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -97,7 +98,7 @@ func (s *execRunningState) transition(name string) error {
|
||||
case "stopped":
|
||||
s.p.execState = &execStoppedState{p: s.p}
|
||||
default:
|
||||
return errors.Errorf("invalid state transition %q to %q", stateName(s), name)
|
||||
return fmt.Errorf("invalid state transition %q to %q", stateName(s), name)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -139,7 +140,7 @@ func (s *execStoppedState) transition(name string) error {
|
||||
case "deleted":
|
||||
s.p.execState = &deletedState{}
|
||||
default:
|
||||
return errors.Errorf("invalid state transition %q to %q", stateName(s), name)
|
||||
return fmt.Errorf("invalid state transition %q to %q", stateName(s), name)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@@ -38,7 +38,6 @@ import (
|
||||
runc "github.com/containerd/go-runc"
|
||||
google_protobuf "github.com/gogo/protobuf/types"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
@@ -120,12 +119,12 @@ func (p *Init) Create(ctx context.Context, r *CreateConfig) error {
|
||||
|
||||
if r.Terminal {
|
||||
if socket, err = runc.NewTempConsoleSocket(); err != nil {
|
||||
return errors.Wrap(err, "failed to create OCI runtime console socket")
|
||||
return fmt.Errorf("failed to create OCI runtime console socket: %w", err)
|
||||
}
|
||||
defer socket.Close()
|
||||
} else {
|
||||
if pio, err = createIO(ctx, p.id, p.IoUID, p.IoGID, p.stdio); err != nil {
|
||||
return errors.Wrap(err, "failed to create init process I/O")
|
||||
return fmt.Errorf("failed to create init process I/O: %w", err)
|
||||
}
|
||||
p.io = pio
|
||||
}
|
||||
@@ -156,21 +155,21 @@ func (p *Init) Create(ctx context.Context, r *CreateConfig) error {
|
||||
if socket != nil {
|
||||
console, err := socket.ReceiveMaster()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to retrieve console master")
|
||||
return fmt.Errorf("failed to retrieve console master: %w", err)
|
||||
}
|
||||
console, err = p.Platform.CopyConsole(ctx, console, p.id, r.Stdin, r.Stdout, r.Stderr, &p.wg)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to start console copy")
|
||||
return fmt.Errorf("failed to start console copy: %w", err)
|
||||
}
|
||||
p.console = console
|
||||
} else {
|
||||
if err := pio.Copy(ctx, &p.wg); err != nil {
|
||||
return errors.Wrap(err, "failed to start io pipe copy")
|
||||
return fmt.Errorf("failed to start io pipe copy: %w", err)
|
||||
}
|
||||
}
|
||||
pid, err := pidFile.Read()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to retrieve OCI runtime container pid")
|
||||
return fmt.Errorf("failed to retrieve OCI runtime container pid: %w", err)
|
||||
}
|
||||
p.pid = pid
|
||||
return nil
|
||||
@@ -179,7 +178,7 @@ func (p *Init) Create(ctx context.Context, r *CreateConfig) error {
|
||||
func (p *Init) openStdin(path string) error {
|
||||
sc, err := fifo.OpenFifo(context.Background(), path, unix.O_WRONLY|unix.O_NONBLOCK, 0)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to open stdin fifo %s", path)
|
||||
return fmt.Errorf("failed to open stdin fifo %s: %w", path, err)
|
||||
}
|
||||
p.stdin = sc
|
||||
p.closers = append(p.closers, sc)
|
||||
@@ -313,7 +312,7 @@ func (p *Init) delete(ctx context.Context) error {
|
||||
if err2 := mount.UnmountAll(p.Rootfs, 0); err2 != nil {
|
||||
log.G(ctx).WithError(err2).Warn("failed to cleanup rootfs mount")
|
||||
if err == nil {
|
||||
err = errors.Wrap(err2, "failed rootfs umount")
|
||||
err = fmt.Errorf("failed rootfs umount: %w", err2)
|
||||
}
|
||||
}
|
||||
return err
|
||||
@@ -482,11 +481,11 @@ func (p *Init) runtimeError(rErr error, msg string) error {
|
||||
rMsg, err := getLastRuntimeError(p.runtime)
|
||||
switch {
|
||||
case err != nil:
|
||||
return errors.Wrapf(rErr, "%s: %s (%s)", msg, "unable to retrieve OCI runtime error", err.Error())
|
||||
return fmt.Errorf("%s: %s (%s): %w", msg, "unable to retrieve OCI runtime error", err.Error(), rErr)
|
||||
case rMsg == "":
|
||||
return errors.Wrap(rErr, msg)
|
||||
return fmt.Errorf("%s: %w", msg, rErr)
|
||||
default:
|
||||
return errors.Errorf("%s: %s", msg, rMsg)
|
||||
return fmt.Errorf("%s: %s", msg, rMsg)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -21,10 +21,11 @@ package process
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
runc "github.com/containerd/go-runc"
|
||||
google_protobuf "github.com/gogo/protobuf/types"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -54,7 +55,7 @@ func (s *createdState) transition(name string) error {
|
||||
case "deleted":
|
||||
s.p.initState = &deletedState{}
|
||||
default:
|
||||
return errors.Errorf("invalid state transition %q to %q", stateName(s), name)
|
||||
return fmt.Errorf("invalid state transition %q to %q", stateName(s), name)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -123,7 +124,7 @@ func (s *createdCheckpointState) transition(name string) error {
|
||||
case "deleted":
|
||||
s.p.initState = &deletedState{}
|
||||
default:
|
||||
return errors.Errorf("invalid state transition %q to %q", stateName(s), name)
|
||||
return fmt.Errorf("invalid state transition %q to %q", stateName(s), name)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -154,7 +155,7 @@ func (s *createdCheckpointState) Start(ctx context.Context) error {
|
||||
)
|
||||
if sio.Terminal {
|
||||
if socket, err = runc.NewTempConsoleSocket(); err != nil {
|
||||
return errors.Wrap(err, "failed to create OCI runtime console socket")
|
||||
return fmt.Errorf("failed to create OCI runtime console socket: %w", err)
|
||||
}
|
||||
defer socket.Close()
|
||||
s.opts.ConsoleSocket = socket
|
||||
@@ -165,27 +166,27 @@ func (s *createdCheckpointState) Start(ctx context.Context) error {
|
||||
}
|
||||
if sio.Stdin != "" {
|
||||
if err := p.openStdin(sio.Stdin); err != nil {
|
||||
return errors.Wrapf(err, "failed to open stdin fifo %s", sio.Stdin)
|
||||
return fmt.Errorf("failed to open stdin fifo %s: %w", sio.Stdin, err)
|
||||
}
|
||||
}
|
||||
if socket != nil {
|
||||
console, err := socket.ReceiveMaster()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to retrieve console master")
|
||||
return fmt.Errorf("failed to retrieve console master: %w", err)
|
||||
}
|
||||
console, err = p.Platform.CopyConsole(ctx, console, p.id, sio.Stdin, sio.Stdout, sio.Stderr, &p.wg)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to start console copy")
|
||||
return fmt.Errorf("failed to start console copy: %w", err)
|
||||
}
|
||||
p.console = console
|
||||
} else {
|
||||
if err := p.io.Copy(ctx, &p.wg); err != nil {
|
||||
return errors.Wrap(err, "failed to start io pipe copy")
|
||||
return fmt.Errorf("failed to start io pipe copy: %w", err)
|
||||
}
|
||||
}
|
||||
pid, err := runc.ReadPidFile(s.opts.PidFile)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to retrieve OCI runtime container pid")
|
||||
return fmt.Errorf("failed to retrieve OCI runtime container pid: %w", err)
|
||||
}
|
||||
p.pid = pid
|
||||
return s.transition("running")
|
||||
@@ -229,7 +230,7 @@ func (s *runningState) transition(name string) error {
|
||||
case "paused":
|
||||
s.p.initState = &pausedState{p: s.p}
|
||||
default:
|
||||
return errors.Errorf("invalid state transition %q to %q", stateName(s), name)
|
||||
return fmt.Errorf("invalid state transition %q to %q", stateName(s), name)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -300,7 +301,7 @@ func (s *pausedState) transition(name string) error {
|
||||
case "stopped":
|
||||
s.p.initState = &stoppedState{p: s.p}
|
||||
default:
|
||||
return errors.Errorf("invalid state transition %q to %q", stateName(s), name)
|
||||
return fmt.Errorf("invalid state transition %q to %q", stateName(s), name)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -366,7 +367,7 @@ func (s *stoppedState) transition(name string) error {
|
||||
case "deleted":
|
||||
s.p.initState = &deletedState{}
|
||||
default:
|
||||
return errors.Errorf("invalid state transition %q to %q", stateName(s), name)
|
||||
return fmt.Errorf("invalid state transition %q to %q", stateName(s), name)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@@ -37,7 +37,6 @@ import (
|
||||
"github.com/containerd/fifo"
|
||||
runc "github.com/containerd/go-runc"
|
||||
"github.com/hashicorp/go-multierror"
|
||||
"github.com/pkg/errors"
|
||||
exec "golang.org/x/sys/execabs"
|
||||
)
|
||||
|
||||
@@ -77,7 +76,7 @@ func (p *processIO) Copy(ctx context.Context, wg *sync.WaitGroup) error {
|
||||
}
|
||||
var cwg sync.WaitGroup
|
||||
if err := copyPipes(ctx, p.IO(), p.stdio.Stdin, p.stdio.Stdout, p.stdio.Stderr, wg, &cwg); err != nil {
|
||||
return errors.Wrap(err, "unable to copy pipes")
|
||||
return fmt.Errorf("unable to copy pipes: %w", err)
|
||||
}
|
||||
cwg.Wait()
|
||||
return nil
|
||||
@@ -97,7 +96,7 @@ func createIO(ctx context.Context, id string, ioUID, ioGID int, stdio stdio.Stdi
|
||||
}
|
||||
u, err := url.Parse(stdio.Stdout)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "unable to parse stdout uri")
|
||||
return nil, fmt.Errorf("unable to parse stdout uri: %w", err)
|
||||
}
|
||||
if u.Scheme == "" {
|
||||
u.Scheme = "fifo"
|
||||
@@ -125,7 +124,7 @@ func createIO(ctx context.Context, id string, ioUID, ioGID int, stdio stdio.Stdi
|
||||
pio.copy = true
|
||||
pio.io, err = runc.NewPipeIO(ioUID, ioGID, withConditionalIO(stdio))
|
||||
default:
|
||||
return nil, errors.Errorf("unknown STDIO scheme %s", u.Scheme)
|
||||
return nil, fmt.Errorf("unknown STDIO scheme %s", u.Scheme)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -189,10 +188,10 @@ func copyPipes(ctx context.Context, rio runc.IO, stdin, stdout, stderr string, w
|
||||
)
|
||||
if ok {
|
||||
if fw, err = fifo.OpenFifo(ctx, i.name, syscall.O_WRONLY, 0); err != nil {
|
||||
return errors.Wrapf(err, "containerd-shim: opening w/o fifo %q failed", i.name)
|
||||
return fmt.Errorf("containerd-shim: opening w/o fifo %q failed: %w", i.name, err)
|
||||
}
|
||||
if fr, err = fifo.OpenFifo(ctx, i.name, syscall.O_RDONLY, 0); err != nil {
|
||||
return errors.Wrapf(err, "containerd-shim: opening r/o fifo %q failed", i.name)
|
||||
return fmt.Errorf("containerd-shim: opening r/o fifo %q failed: %w", i.name, err)
|
||||
}
|
||||
} else {
|
||||
if sameFile != nil {
|
||||
@@ -201,7 +200,7 @@ func copyPipes(ctx context.Context, rio runc.IO, stdin, stdout, stderr string, w
|
||||
continue
|
||||
}
|
||||
if fw, err = os.OpenFile(i.name, syscall.O_WRONLY|syscall.O_APPEND, 0); err != nil {
|
||||
return errors.Wrapf(err, "containerd-shim: opening file %q failed", i.name)
|
||||
return fmt.Errorf("containerd-shim: opening file %q failed: %w", i.name, err)
|
||||
}
|
||||
if stdout == stderr {
|
||||
sameFile = &countingWriteCloser{
|
||||
@@ -266,13 +265,13 @@ func NewBinaryIO(ctx context.Context, id string, uri *url.URL) (_ runc.IO, err e
|
||||
|
||||
out, err := newPipe()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to create stdout pipes")
|
||||
return nil, fmt.Errorf("failed to create stdout pipes: %w", err)
|
||||
}
|
||||
closers = append(closers, out.Close)
|
||||
|
||||
serr, err := newPipe()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to create stderr pipes")
|
||||
return nil, fmt.Errorf("failed to create stderr pipes: %w", err)
|
||||
}
|
||||
closers = append(closers, serr.Close)
|
||||
|
||||
@@ -287,19 +286,19 @@ func NewBinaryIO(ctx context.Context, id string, uri *url.URL) (_ runc.IO, err e
|
||||
// don't need to register this with the reaper or wait when
|
||||
// running inside a shim
|
||||
if err := cmd.Start(); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to start binary process")
|
||||
return nil, fmt.Errorf("failed to start binary process: %w", err)
|
||||
}
|
||||
closers = append(closers, func() error { return cmd.Process.Kill() })
|
||||
|
||||
// close our side of the pipe after start
|
||||
if err := w.Close(); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to close write pipe after start")
|
||||
return nil, fmt.Errorf("failed to close write pipe after start: %w", err)
|
||||
}
|
||||
|
||||
// wait for the logging binary to be ready
|
||||
b := make([]byte, 1)
|
||||
if _, err := r.Read(b); err != nil && err != io.EOF {
|
||||
return nil, errors.Wrap(err, "failed to read from logging binary")
|
||||
return nil, fmt.Errorf("failed to read from logging binary: %w", err)
|
||||
}
|
||||
|
||||
return &binaryIO{
|
||||
@@ -357,12 +356,12 @@ func (b *binaryIO) cancel() error {
|
||||
|
||||
// Send SIGTERM first, so logger process has a chance to flush and exit properly
|
||||
if err := b.cmd.Process.Signal(syscall.SIGTERM); err != nil {
|
||||
result := multierror.Append(errors.Wrap(err, "failed to send SIGTERM"))
|
||||
result := multierror.Append(fmt.Errorf("failed to send SIGTERM: %w", err))
|
||||
|
||||
log.L.WithError(err).Warn("failed to send SIGTERM signal, killing logging shim")
|
||||
|
||||
if err := b.cmd.Process.Kill(); err != nil {
|
||||
result = multierror.Append(result, errors.Wrap(err, "failed to kill process after faulty SIGTERM"))
|
||||
result = multierror.Append(result, fmt.Errorf("failed to kill process after faulty SIGTERM: %w", err))
|
||||
}
|
||||
|
||||
return result.ErrorOrNil()
|
||||
@@ -381,7 +380,7 @@ func (b *binaryIO) cancel() error {
|
||||
|
||||
err := b.cmd.Process.Kill()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to kill shim logger process")
|
||||
return fmt.Errorf("failed to kill shim logger process: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -429,11 +428,11 @@ func (p *pipe) Close() error {
|
||||
var result *multierror.Error
|
||||
|
||||
if err := p.w.Close(); err != nil {
|
||||
result = multierror.Append(result, errors.Wrap(err, "failed to close write pipe"))
|
||||
result = multierror.Append(result, fmt.Errorf("failed to close write pipe: %w", err))
|
||||
}
|
||||
|
||||
if err := p.r.Close(); err != nil {
|
||||
result = multierror.Append(result, errors.Wrap(err, "failed to close read pipe"))
|
||||
result = multierror.Append(result, fmt.Errorf("failed to close read pipe: %w", err))
|
||||
}
|
||||
|
||||
return multierror.Prefix(result.ErrorOrNil(), "pipe:")
|
||||
|
@@ -33,7 +33,6 @@ import (
|
||||
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
runc "github.com/containerd/go-runc"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
@@ -137,11 +136,11 @@ func checkKillError(err error) error {
|
||||
strings.Contains(err.Error(), "container not running") ||
|
||||
strings.Contains(strings.ToLower(err.Error()), "no such process") ||
|
||||
err == unix.ESRCH {
|
||||
return errors.Wrapf(errdefs.ErrNotFound, "process already finished")
|
||||
return fmt.Errorf("process already finished: %w", errdefs.ErrNotFound)
|
||||
} else if strings.Contains(err.Error(), "does not exist") {
|
||||
return errors.Wrapf(errdefs.ErrNotFound, "no such container")
|
||||
return fmt.Errorf("no such container: %w", errdefs.ErrNotFound)
|
||||
}
|
||||
return errors.Wrapf(err, "unknown error after kill")
|
||||
return fmt.Errorf("unknown error after kill: %w", err)
|
||||
}
|
||||
|
||||
func newPidFile(bundle string) *pidFile {
|
||||
@@ -199,5 +198,5 @@ func stateName(v interface{}) string {
|
||||
case *stoppedState:
|
||||
return "stopped"
|
||||
}
|
||||
panic(errors.Errorf("invalid state %v", v))
|
||||
panic(fmt.Errorf("invalid state %v", v))
|
||||
}
|
||||
|
Reference in New Issue
Block a user