Explorar o código

fix nil error type

Mohammed Nafees %!s(int64=4) %!d(string=hai) anos
pai
achega
7815442565
Modificáronse 1 ficheiros con 2 adicións e 6 borrados
  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))