Browse code

libnetwork: remove ErrDataStoreNotInitialized

If was not used as a sentinel error, so inline the error.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2023/07/29 09:02:17
Showing 2 changed files
... ...
@@ -1,7 +1,6 @@
1 1
 package libnetwork
2 2
 
3 3
 import (
4
-	"errors"
5 4
 	"fmt"
6 5
 )
7 6
 
... ...
@@ -108,7 +107,3 @@ func (mr ManagerRedirectError) Error() string {
108 108
 
109 109
 // Maskable denotes the type of this error
110 110
 func (mr ManagerRedirectError) Maskable() {}
111
-
112
-// ErrDataStoreNotInitialized is returned if an invalid data scope is passed
113
-// for getting data store
114
-var ErrDataStoreNotInitialized = errors.New("datastore is not initialized")
... ...
@@ -157,7 +157,7 @@ func (n *Network) getEndpointsFromStore() ([]*Endpoint, error) {
157 157
 func (c *Controller) updateToStore(kvObject datastore.KVObject) error {
158 158
 	cs := c.getStore()
159 159
 	if cs == nil {
160
-		return ErrDataStoreNotInitialized
160
+		return fmt.Errorf("datastore is not initialized")
161 161
 	}
162 162
 
163 163
 	if err := cs.PutObjectAtomic(kvObject); err != nil {
... ...
@@ -173,7 +173,7 @@ func (c *Controller) updateToStore(kvObject datastore.KVObject) error {
173 173
 func (c *Controller) deleteFromStore(kvObject datastore.KVObject) error {
174 174
 	cs := c.getStore()
175 175
 	if cs == nil {
176
-		return ErrDataStoreNotInitialized
176
+		return fmt.Errorf("datastore is not initialized")
177 177
 	}
178 178
 
179 179
 retry: