Browse Source

fix nil error type

Mohammed Nafees 3 years ago
parent
commit
7815442565
1 changed files with 2 additions and 6 deletions
  1. 2 6
      api/server/handlers/namespace/stream_pod_logs.go

+ 2 - 6
api/server/handlers/namespace/stream_pod_logs.go

@@ -62,12 +62,8 @@ func (c *StreamPodLogsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
 		))
 
 		return
-	} else if brErr := (kubernetes.BadRequestError{}); errors.As(err, &targetErr) {
-		c.HandleAPIError(w, r, apierrors.NewErrPassThroughToClient(
-			&brErr,
-			http.StatusBadRequest,
-		))
-
+	} else if _, ok := err.(*kubernetes.BadRequestError); ok {
+		c.HandleAPIError(w, r, apierrors.NewErrPassThroughToClient(err, http.StatusBadRequest))
 		return
 	} else if err != nil {
 		c.HandleAPIError(w, r, apierrors.NewErrInternal(err))