mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	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
This commit is contained in:
		@@ -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
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user