-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
41 lines (32 loc) · 1007 Bytes
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package daemon
import (
"fmt"
"github.com/docker/docker/api/errors"
)
func (d *Daemon) imageNotExistToErrcode(err error) error {
if dne, isDNE := err.(ErrImageDoesNotExist); isDNE {
return errors.NewRequestNotFoundError(dne)
}
return err
}
type errNotRunning struct {
containerID string
}
func (e errNotRunning) Error() string {
return fmt.Sprintf("Container %s is not running", e.containerID)
}
func (e errNotRunning) ContainerIsRunning() bool {
return false
}
func errContainerIsRestarting(containerID string) error {
err := fmt.Errorf("Container %s is restarting, wait until the container is running", containerID)
return errors.NewRequestConflictError(err)
}
func errExecNotFound(id string) error {
err := fmt.Errorf("No such exec instance '%s' found in daemon", id)
return errors.NewRequestNotFoundError(err)
}
func errExecPaused(id string) error {
err := fmt.Errorf("Container %s is paused, unpause the container before exec", id)
return errors.NewRequestConflictError(err)
}