Merge pull request #65560 from smarterclayton/print_better_type_info

Automatic merge from submit-queue (batch tested with PRs 65453, 65523, 65513, 65560). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Print type information when unknown watch error

Got

```
E0628 00:23:07.106285       1 watch.go:274] unable to encode watch object: expected pointer, but got invalid kind
```

on a production system and had no way to debug what type was being sent.

@liggitt re: the message I sent you
pull/8/head
Kubernetes Submit Queue 2018-06-27 22:30:15 -07:00 committed by GitHub
commit c4ca6638c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -209,7 +209,7 @@ func (s *WatchServer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
s.Fixup(obj)
if err := s.EmbeddedEncoder.Encode(obj, buf); err != nil {
// unexpected error
utilruntime.HandleError(fmt.Errorf("unable to encode watch object: %v", err))
utilruntime.HandleError(fmt.Errorf("unable to encode watch object %T: %v", obj, err))
return
}
@ -230,7 +230,7 @@ func (s *WatchServer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
if err := e.Encode(outEvent); err != nil {
utilruntime.HandleError(fmt.Errorf("unable to encode watch object: %v (%#v)", err, e))
utilruntime.HandleError(fmt.Errorf("unable to encode watch object %T: %v (%#v)", outEvent, err, e))
// client disconnect.
return
}
@ -276,7 +276,7 @@ func (s *WatchServer) HandleWS(ws *websocket.Conn) {
s.Fixup(obj)
if err := s.EmbeddedEncoder.Encode(obj, buf); err != nil {
// unexpected error
utilruntime.HandleError(fmt.Errorf("unable to encode watch object: %v", err))
utilruntime.HandleError(fmt.Errorf("unable to encode watch object %T: %v", obj, err))
return
}