瀏覽代碼

Add a debug message when client closes websocket attach connection

When the client closes websocket connections that sends container
output through websocket, an error message is displayed:
"Error attaching websocket: %!s(<nil>)"

This message is misleading. Thus, this change suggests to check
if error is nil and print the correct message accordingly.

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Boaz Shuster 7 年之前
父節點
當前提交
8f65bb6d90
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      api/server/router/container/container_routes.go

+ 5 - 1
api/server/router/container/container_routes.go

@@ -593,7 +593,11 @@ func (s *containerRouter) wsContainersAttach(ctx context.Context, w http.Respons
 	close(done)
 	select {
 	case <-started:
-		logrus.Errorf("Error attaching websocket: %s", err)
+		if err != nil {
+			logrus.Errorf("Error attaching websocket: %s", err)
+		} else {
+			logrus.Debug("websocket connection was closed by client")
+		}
 		return nil
 	default:
 	}