don't swallow bad request errors

This commit is contained in:
Paul Weil 2015-08-13 14:31:56 -04:00
parent 46ed7713be
commit f1d0835235

View File

@ -17,7 +17,7 @@ limitations under the License.
package resource
import (
"github.com/golang/glog"
"fmt"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/meta"
@ -50,11 +50,10 @@ func (r *Selector) Visit(fn VisitorFunc) error {
if err != nil {
if errors.IsBadRequest(err) || errors.IsNotFound(err) {
if r.Selector.Empty() {
glog.V(2).Infof("Unable to list %q: %v", r.Mapping.Resource, err)
return fmt.Errorf("Unable to list %q: %v", r.Mapping.Resource, err)
} else {
glog.V(2).Infof("Unable to find %q that match the selector %q: %v", r.Mapping.Resource, r.Selector, err)
return fmt.Errorf("Unable to find %q that match the selector %q: %v", r.Mapping.Resource, r.Selector, err)
}
return nil
}
return err
}