-
Notifications
You must be signed in to change notification settings - Fork 1.1k
oci: return IsAlive error instead of logging #4149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,7 @@ | ||
| package server | ||
|
|
||
| import ( | ||
| "fmt" | ||
|
|
||
| "github.com/pkg/errors" | ||
| "golang.org/x/net/context" | ||
| "google.golang.org/grpc/codes" | ||
| "google.golang.org/grpc/status" | ||
|
|
@@ -16,13 +15,13 @@ func (s *Server) ExecSync(ctx context.Context, req *pb.ExecSyncRequest) (*pb.Exe | |
| return nil, status.Errorf(codes.NotFound, "could not find container %q: %v", req.ContainerId, err) | ||
| } | ||
|
|
||
| if !c.IsAlive() { | ||
| return nil, fmt.Errorf("container is not created or running") | ||
| if err := c.IsAlive(); err != nil { | ||
| return nil, status.Errorf(codes.NotFound, "container is not created or running: %v", err) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you include the container id as well?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's included in the return value of IsAlive()
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should I move that up a level?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it's fine! |
||
| } | ||
|
|
||
| cmd := req.Cmd | ||
| if cmd == nil { | ||
| return nil, fmt.Errorf("exec command cannot be empty") | ||
| return nil, errors.New("exec command cannot be empty") | ||
| } | ||
|
|
||
| execResp, err := s.Runtime().ExecSyncContainer(c, cmd, req.Timeout) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we missing the return nil case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the supplied err is nil, wrapf returns nil
https://godoc.org/github.com/pkg/errors#Wrap