diff options
author | Fabricio Voznika <fvoznika@google.com> | 2019-01-18 17:35:09 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-01-18 17:36:02 -0800 |
commit | c1be25b78d89a3a55a32a7aa10724134eda9813d (patch) | |
tree | bb5c09cb94ab212c158041b260ed0bb480e2a9d5 /runsc/console/console.go | |
parent | c0a981629cf44688687548490c5e665d851afe06 (diff) |
Scrub runsc error messages
Removed "error" and "failed to" prefix that don't add value
from messages. Adjusted a few other messages. In particular,
when the container fail to start, the message returned is easier
for humans to read:
$ docker run --rm --runtime=runsc alpine foobar
docker: Error response from daemon: OCI runtime start failed: <path> did not terminate sucessfully: starting container: starting root container [foobar]: starting sandbox: searching for executable "foobar", cwd: "/", $PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin": no such file or directory
Closes #77
PiperOrigin-RevId: 230022798
Change-Id: I83339017c70dae09e4f9f8e0ea2e554c4d5d5cd1
Diffstat (limited to 'runsc/console/console.go')
-rw-r--r-- | runsc/console/console.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/runsc/console/console.go b/runsc/console/console.go index 9f4f9214d..2eb9a8807 100644 --- a/runsc/console/console.go +++ b/runsc/console/console.go @@ -30,7 +30,7 @@ func NewWithSocket(socketPath string) (*os.File, error) { // Create a new pty master and slave. ptyMaster, ptySlave, err := pty.Open() if err != nil { - return nil, fmt.Errorf("error opening pty: %v", err) + return nil, fmt.Errorf("opening pty: %v", err) } defer ptyMaster.Close() @@ -38,7 +38,7 @@ func NewWithSocket(socketPath string) (*os.File, error) { conn, err := net.Dial("unix", socketPath) if err != nil { ptySlave.Close() - return nil, fmt.Errorf("error dial socket %q: %v", socketPath, err) + return nil, fmt.Errorf("dialing socket %q: %v", socketPath, err) } defer conn.Close() uc, ok := conn.(*net.UnixConn) @@ -49,7 +49,7 @@ func NewWithSocket(socketPath string) (*os.File, error) { socket, err := uc.File() if err != nil { ptySlave.Close() - return nil, fmt.Errorf("error getting file for unix socket %v: %v", uc, err) + return nil, fmt.Errorf("getting file for unix socket %v: %v", uc, err) } defer socket.Close() @@ -57,7 +57,7 @@ func NewWithSocket(socketPath string) (*os.File, error) { msg := unix.UnixRights(int(ptyMaster.Fd())) if err := unix.Sendmsg(int(socket.Fd()), []byte("pty-master"), msg, nil, 0); err != nil { ptySlave.Close() - return nil, fmt.Errorf("error sending console over unix socket %q: %v", socketPath, err) + return nil, fmt.Errorf("sending console over unix socket %q: %v", socketPath, err) } return ptySlave, nil } |