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