Make all error strings lower case, for readability.

This commit is contained in:
Brendan Burns 2014-06-13 15:45:19 -07:00
parent 505f01a7ca
commit 482a360f9e
12 changed files with 19 additions and 19 deletions

View File

@ -109,7 +109,7 @@ func TestSimpleList(t *testing.T) {
func TestErrorList(t *testing.T) { func TestErrorList(t *testing.T) {
storage := map[string]RESTStorage{} storage := map[string]RESTStorage{}
simpleStorage := SimpleRESTStorage{ simpleStorage := SimpleRESTStorage{
err: fmt.Errorf("Test Error"), err: fmt.Errorf("test Error"),
} }
storage["simple"] = &simpleStorage storage["simple"] = &simpleStorage
handler := New(storage, "/prefix/version") handler := New(storage, "/prefix/version")

View File

@ -183,7 +183,7 @@ func (h *HumanReadablePrinter) extractObject(data, kind string) (interface{}, er
} }
return list, nil return list, nil
default: default:
return nil, fmt.Errorf("Unknown kind: %s", kind) return nil, fmt.Errorf("unknown kind: %s", kind)
} }
} }
@ -196,7 +196,7 @@ func (h *HumanReadablePrinter) Print(data string, output io.Writer) error {
} }
if _, contains := obj.(map[string]interface{})["kind"]; !contains { if _, contains := obj.(map[string]interface{})["kind"]; !contains {
return fmt.Errorf("Unexpected object with no 'kind' field: %s", data) return fmt.Errorf("unexpected object with no 'kind' field: %s", data)
} }
kind := (obj.(map[string]interface{})["kind"]).(string) kind := (obj.(map[string]interface{})["kind"]).(string)
obj, err := h.extractObject(data, kind) obj, err := h.extractObject(data, kind)

View File

@ -504,7 +504,7 @@ func (kl *Kubelet) ExtractYAMLData(buf []byte, output interface{}) error {
func (kl *Kubelet) extractFromEtcd(response *etcd.Response) ([]api.ContainerManifest, error) { func (kl *Kubelet) extractFromEtcd(response *etcd.Response) ([]api.ContainerManifest, error) {
var manifests []api.ContainerManifest var manifests []api.ContainerManifest
if response.Node == nil || len(response.Node.Value) == 0 { if response.Node == nil || len(response.Node.Value) == 0 {
return manifests, fmt.Errorf("No nodes field: %#v", response) return manifests, fmt.Errorf("no nodes field: %#v", response)
} }
err := kl.ExtractYAMLData([]byte(response.Node.Value), &manifests) err := kl.ExtractYAMLData([]byte(response.Node.Value), &manifests)
return manifests, err return manifests, err

View File

@ -302,7 +302,7 @@ func TestListContainers(t *testing.T) {
func TestKillContainerWithError(t *testing.T) { func TestKillContainerWithError(t *testing.T) {
fakeDocker := FakeDockerClient{ fakeDocker := FakeDockerClient{
err: fmt.Errorf("Sample Error"), err: fmt.Errorf("sample error"),
containerList: []docker.APIContainers{ containerList: []docker.APIContainers{
{ {
Names: []string{"foo"}, Names: []string{"foo"},
@ -585,7 +585,7 @@ func TestEventWritingError(t *testing.T) {
kubelet := &Kubelet{ kubelet := &Kubelet{
Client: fakeEtcd, Client: fakeEtcd,
} }
fakeEtcd.Err = fmt.Errorf("Test error") fakeEtcd.Err = fmt.Errorf("test error")
err := kubelet.LogEvent(&api.Event{ err := kubelet.LogEvent(&api.Event{
Event: "test", Event: "test",
Container: &api.Container{ Container: &api.Container{

View File

@ -51,7 +51,7 @@ func (registry *MockControllerRegistry) DeleteController(ID string) error {
func TestListControllersError(t *testing.T) { func TestListControllersError(t *testing.T) {
mockRegistry := MockControllerRegistry{ mockRegistry := MockControllerRegistry{
err: fmt.Errorf("Test Error"), err: fmt.Errorf("test error"),
} }
storage := ControllerRegistryStorage{ storage := ControllerRegistryStorage{
registry: &mockRegistry, registry: &mockRegistry,

View File

@ -33,7 +33,7 @@ func TestSyncEndpointsEmpty(t *testing.T) {
func TestSyncEndpointsError(t *testing.T) { func TestSyncEndpointsError(t *testing.T) {
serviceRegistry := MockServiceRegistry{ serviceRegistry := MockServiceRegistry{
err: fmt.Errorf("Test Error"), err: fmt.Errorf("test error"),
} }
podRegistry := MockPodRegistry{} podRegistry := MockPodRegistry{}

View File

@ -147,7 +147,7 @@ func (registry *EtcdRegistry) updateManifests(machine string, manifests []api.Co
func (registry *EtcdRegistry) CreatePod(machineIn string, pod api.Pod) error { func (registry *EtcdRegistry) CreatePod(machineIn string, pod api.Pod) error {
podOut, machine, err := registry.findPod(pod.ID) podOut, machine, err := registry.findPod(pod.ID)
if err == nil { if err == nil {
return fmt.Errorf("A pod named %s already exists on %s (%#v)", pod.ID, machine, podOut) return fmt.Errorf("a pod named %s already exists on %s (%#v)", pod.ID, machine, podOut)
} }
return registry.runPod(pod, machineIn) return registry.runPod(pod, machineIn)
} }
@ -174,7 +174,7 @@ func (registry *EtcdRegistry) runPod(pod api.Pod, machine string) error {
} }
func (registry *EtcdRegistry) UpdatePod(pod api.Pod) error { func (registry *EtcdRegistry) UpdatePod(pod api.Pod) error {
return fmt.Errorf("Unimplemented!") return fmt.Errorf("unimplemented!")
} }
func (registry *EtcdRegistry) DeletePod(podID string) error { func (registry *EtcdRegistry) DeletePod(podID string) error {
@ -218,7 +218,7 @@ func (registry *EtcdRegistry) getPodForMachine(machine, podID string) (api.Pod,
result, err := registry.etcdClient.Get(key, false, false) result, err := registry.etcdClient.Get(key, false, false)
if err != nil { if err != nil {
if isEtcdNotFound(err) { if isEtcdNotFound(err) {
return api.Pod{}, fmt.Errorf("Not found (%#v).", err) return api.Pod{}, fmt.Errorf("not found (%#v).", err)
} else { } else {
return api.Pod{}, err return api.Pod{}, err
} }
@ -239,7 +239,7 @@ func (registry *EtcdRegistry) findPod(podID string) (api.Pod, string, error) {
return pod, machine, nil return pod, machine, nil
} }
} }
return api.Pod{}, "", fmt.Errorf("Pod not found %s", podID) return api.Pod{}, "", fmt.Errorf("pod not found %s", podID)
} }
func isEtcdNotFound(err error) bool { func isEtcdNotFound(err error) bool {
@ -284,7 +284,7 @@ func (registry *EtcdRegistry) GetController(controllerID string) (*api.Replicati
result, err := registry.etcdClient.Get(key, false, false) result, err := registry.etcdClient.Get(key, false, false)
if err != nil { if err != nil {
if isEtcdNotFound(err) { if isEtcdNotFound(err) {
return nil, fmt.Errorf("Controller %s not found", controllerID) return nil, fmt.Errorf("controller %s not found", controllerID)
} else { } else {
return nil, err return nil, err
} }
@ -354,7 +354,7 @@ func (registry *EtcdRegistry) GetService(name string) (*api.Service, error) {
response, err := registry.etcdClient.Get(key, false, false) response, err := registry.etcdClient.Get(key, false, false)
if err != nil { if err != nil {
if isEtcdNotFound(err) { if isEtcdNotFound(err) {
return nil, fmt.Errorf("Service %s was not found.", name) return nil, fmt.Errorf("service %s was not found.", name)
} else { } else {
return nil, err return nil, err
} }

View File

@ -76,7 +76,7 @@ func (f *FakeEtcdClient) Delete(key string, recursive bool) (*etcd.Response, err
} }
func (f *FakeEtcdClient) Watch(prefix string, waitIndex uint64, recursive bool, receiver chan *etcd.Response, stop chan bool) (*etcd.Response, error) { func (f *FakeEtcdClient) Watch(prefix string, waitIndex uint64, recursive bool, receiver chan *etcd.Response, stop chan bool) (*etcd.Response, error) {
return nil, fmt.Errorf("Unimplemented") return nil, fmt.Errorf("unimplemented")
} }
func MakeTestEtcdRegistry(client EtcdClient, machines []string) *EtcdRegistry { func MakeTestEtcdRegistry(client EtcdClient, machines []string) *EtcdRegistry {

View File

@ -122,7 +122,7 @@ func (storage *PodRegistryStorage) Extract(body string) (interface{}, error) {
func (storage *PodRegistryStorage) Create(pod interface{}) error { func (storage *PodRegistryStorage) Create(pod interface{}) error {
podObj := pod.(api.Pod) podObj := pod.(api.Pod)
if len(podObj.ID) == 0 { if len(podObj.ID) == 0 {
return fmt.Errorf("ID is unspecified: %#v", pod) return fmt.Errorf("id is unspecified: %#v", pod)
} }
machine, err := storage.scheduler.Schedule(podObj) machine, err := storage.scheduler.Schedule(podObj)
if err != nil { if err != nil {

View File

@ -56,7 +56,7 @@ func (registry *MockPodRegistry) DeletePod(podId string) error {
func TestListPodsError(t *testing.T) { func TestListPodsError(t *testing.T) {
mockRegistry := MockPodRegistry{ mockRegistry := MockPodRegistry{
err: fmt.Errorf("Test Error"), err: fmt.Errorf("test error"),
} }
storage := PodRegistryStorage{ storage := PodRegistryStorage{
registry: &mockRegistry, registry: &mockRegistry,

View File

@ -112,7 +112,7 @@ func (rm *ReplicationManager) handleWatchResponse(response *etcd.Response) (*api
} }
return &controllerSpec, nil return &controllerSpec, nil
} else { } else {
return nil, fmt.Errorf("Response node is null %#v", response) return nil, fmt.Errorf("response node is null %#v", response)
} }
} }
return nil, nil return nil, nil

View File

@ -115,7 +115,7 @@ func (s *FirstFitScheduler) Schedule(pod api.Pod) (string, error) {
} }
} }
if len(machineOptions) == 0 { if len(machineOptions) == 0 {
return "", fmt.Errorf("Failed to find fit for %#v", pod) return "", fmt.Errorf("failed to find fit for %#v", pod)
} else { } else {
return machineOptions[s.random.Int()%len(machineOptions)], nil return machineOptions[s.random.Int()%len(machineOptions)], nil
} }