From 714550f87c690427f7618f61519b96b3dffa00aa Mon Sep 17 00:00:00 2001 From: rajasec Date: Thu, 25 Aug 2016 22:53:35 +0530 Subject: [PATCH] Error handling when container not exists Signed-off-by: rajasec Error handling when container not exists Signed-off-by: rajasec Error handling when container not exists Signed-off-by: rajasec Error handling when container not exists Signed-off-by: rajasec --- libcontainer/factory_linux.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libcontainer/factory_linux.go b/libcontainer/factory_linux.go index e3e00978..0abc2c5a 100644 --- a/libcontainer/factory_linux.go +++ b/libcontainer/factory_linux.go @@ -188,7 +188,7 @@ func (l *LinuxFactory) Load(id string) (Container, error) { return nil, newGenericError(fmt.Errorf("invalid root"), ConfigInvalid) } containerRoot := filepath.Join(l.Root, id) - state, err := l.loadState(containerRoot) + state, err := l.loadState(containerRoot, id) if err != nil { return nil, err } @@ -273,11 +273,11 @@ func (l *LinuxFactory) StartInitialization() (err error) { return i.Init() } -func (l *LinuxFactory) loadState(root string) (*State, error) { +func (l *LinuxFactory) loadState(root, id string) (*State, error) { f, err := os.Open(filepath.Join(root, stateFilename)) if err != nil { if os.IsNotExist(err) { - return nil, newGenericError(err, ContainerNotExists) + return nil, newGenericError(fmt.Errorf("container %q does not exists", id), ContainerNotExists) } return nil, newGenericError(err, SystemError) }