mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-15 14:14:39 +00:00
Provide helpers and tests for common error types
Unify error handling in apiserver into a single path - RESTStorage objects must provide appropriate errors individually. Ensure ALL errors which can be traced to logical faults with RESTStorage are returned as api.Status objects.
This commit is contained in:
@@ -31,6 +31,7 @@ import (
|
||||
|
||||
type WatchHandler struct {
|
||||
storage map[string]RESTStorage
|
||||
codec Codec
|
||||
}
|
||||
|
||||
func getWatchParams(query url.Values) (label, field labels.Selector, resourceVersion uint64) {
|
||||
@@ -64,7 +65,7 @@ func (h *WatchHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
label, field, resourceVersion := getWatchParams(req.URL.Query())
|
||||
watching, err := watcher.Watch(label, field, resourceVersion)
|
||||
if err != nil {
|
||||
internalError(err, w)
|
||||
errorJSON(err, h.codec, w)
|
||||
return
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user