From b276132e214677b88864ec396e2bbf232621359a Mon Sep 17 00:00:00 2001 From: Federico Simoncelli Date: Wed, 1 Apr 2015 09:23:16 -0400 Subject: [PATCH] event: improve logging on recording failure Signed-off-by: Federico Simoncelli --- pkg/client/record/event.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/pkg/client/record/event.go b/pkg/client/record/event.go index 33db471816..37247f6f48 100644 --- a/pkg/client/record/event.go +++ b/pkg/client/record/event.go @@ -155,24 +155,20 @@ func recordEvent(sink EventSink, event *api.Event, updateExistingEvent bool) boo // If we can't contact the server, then hold everything while we keep trying. // Otherwise, something about the event is malformed and we should abandon it. - giveUp := false switch err.(type) { case *client.RequestConstructionError: // We will construct the request the same next time, so don't keep trying. - giveUp = true + glog.Errorf("Unable to construct event '%#v': '%v' (will not retry!)", event, err) + return true case *errors.StatusError: - // This indicates that the server understood and rejected our request. - giveUp = true + glog.Errorf("Server rejected event '%#v': '%v' (will not retry!)", event, err) + return true case *errors.UnexpectedObjectError: // We don't expect this; it implies the server's response didn't match a // known pattern. Go ahead and retry. default: // This case includes actual http transport errors. Go ahead and retry. } - if giveUp { - glog.Errorf("Unable to write event '%#v': '%v' (will not retry!)", event, err) - return true - } glog.Errorf("Unable to write event: '%v' (may retry after sleeping)", err) return false }