Append error message to internal errors

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
Kenfe-Mickael Laventure 2016-03-24 21:20:56 -07:00
parent e500586d8f
commit bac78851e0

View file

@ -124,7 +124,7 @@ func (s *apiServer) State(ctx context.Context, r *types.StateRequest) (*types.St
func createAPIContainer(c runtime.Container, getPids bool) (*types.Container, error) { func createAPIContainer(c runtime.Container, getPids bool) (*types.Container, error) {
processes, err := c.Processes() processes, err := c.Processes()
if err != nil { if err != nil {
return nil, grpc.Errorf(codes.Internal, "get processes for container") return nil, grpc.Errorf(codes.Internal, "get processes for container: "+err.Error())
} }
var procs []*types.Process var procs []*types.Process
for _, p := range processes { for _, p := range processes {
@ -148,7 +148,7 @@ func createAPIContainer(c runtime.Container, getPids bool) (*types.Container, er
state := c.State() state := c.State()
if getPids && (state == runtime.Running || state == runtime.Paused) { if getPids && (state == runtime.Running || state == runtime.Paused) {
if pids, err = c.Pids(); err != nil { if pids, err = c.Pids(); err != nil {
return nil, grpc.Errorf(codes.Internal, "get all pids for container") return nil, grpc.Errorf(codes.Internal, "get all pids for container: "+err.Error())
} }
} }
return &types.Container{ return &types.Container{