Przeglądaj źródła

store: always check the error

Ensure that we propogate any errors out of the node.Remove operation
back to the user. There is no reason to assume here.
Brandon Philips 11 lat temu
rodzic
commit
2a675c08c2
1 zmienionych plików z 4 dodań i 2 usunięć
  1. 4 2
      store/store.go

+ 4 - 2
store/store.go

@@ -354,8 +354,10 @@ func (s *store) CompareAndDelete(nodePath string, prevValue string, prevIndex ui
 		s.WatcherHub.notifyWatchers(e, path, true)
 		s.WatcherHub.notifyWatchers(e, path, true)
 	}
 	}
 
 
-	// delete a key-value pair, no error should happen
-	n.Remove(false, false, callback)
+	err = n.Remove(false, false, callback)
+	if err != nil {
+		return nil, err
+	}
 
 
 	s.WatcherHub.notify(e)
 	s.WatcherHub.notify(e)
 	s.Stats.Inc(CompareAndDeleteSuccess)
 	s.Stats.Inc(CompareAndDeleteSuccess)