Merge pull request #722 from smarterclayton/improve_errors

Normalize apiserver error handling of standard errors
This commit is contained in:
Daniel Smith
2014-08-11 12:43:06 -07:00
6 changed files with 202 additions and 113 deletions

View File

@@ -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) {
@@ -66,7 +67,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
}