From 74db9a1b20186067cf48905b724ed4a2a39d97b9 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Thu, 18 Sep 2014 06:44:21 -0400 Subject: [PATCH] Log apiserver errors that are not of an expected type Currently HttpLog only expected status range - this logs errors that come back from a REST storage object without being first converted to something in pkg/api/errors. This usually indicates unexpected error conditions that a programmer didn't explicitly check for - the kinds of problems that may need debugging by an operator later. Set to V(1) because they don't impair normal operation. --- pkg/apiserver/errors.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/apiserver/errors.go b/pkg/apiserver/errors.go index 5172ef303b9..460d57540e1 100644 --- a/pkg/apiserver/errors.go +++ b/pkg/apiserver/errors.go @@ -22,6 +22,7 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/tools" + "github.com/golang/glog" ) // statusError is an object that can be converted into an api.Status @@ -44,6 +45,11 @@ func errToAPIStatus(err error) *api.Status { case tools.IsEtcdTestFailed(err): status = http.StatusConflict } + // Log errors that were not converted to an error status + // by REST storage - these typically indicate programmer + // error by not using pkg/api/errors, or unexpected failure + // cases. + glog.V(1).Infof("An unchecked error was received: %v", err) return &api.Status{ Status: api.StatusFailure, Code: status,