Browse code

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 authored on 2017/12/06 23:45:33
Showing 1 changed files
... ...
@@ -593,7 +593,11 @@ func (s *containerRouter) wsContainersAttach(ctx context.Context, w http.Respons
593 593
 	close(done)
594 594
 	select {
595 595
 	case <-started:
596
-		logrus.Errorf("Error attaching websocket: %s", err)
596
+		if err != nil {
597
+			logrus.Errorf("Error attaching websocket: %s", err)
598
+		} else {
599
+			logrus.Debug("websocket connection was closed by client")
600
+		}
597 601
 		return nil
598 602
 	default:
599 603
 	}