code: func ErrorNegotiated(err error, s runtime.NegotiatedSerializer, gv schema.GroupVersion, w http.ResponseWriter, req *http.Request) int {
  	status := ErrorToAPIStatus(err)
  	code := int(status.Code)
  	// when writing an error, check to see if the status indicates a retry after period
  	if status.Details != nil && status.Details.RetryAfterSeconds > 0 {
  		delay := strconv.Itoa(int(status.Details.RetryAfterSeconds))
  		w.Header().Set("Retry-After", delay)
  	}
  
  	if code == http.StatusNoContent {
  		w.WriteHeader(code)
  		return code
  	}
  
  	WriteObjectNegotiated(s, negotiation.DefaultEndpointRestrictions, gv, w, req, code, status)
  	return code
  }
docs: // ErrorNegotiated renders an error to the response. Returns the HTTP status code of the error.
  // The context is optional and may be nil.