check error
This commit is contained in:
parent
382a28f775
commit
f1d32e7baf
@ -139,7 +139,10 @@ func (c *client) Remove(param ProfileParam) ([]byte, error) {
|
||||
|
||||
// the json.Marshal function can return two types of errors: UnsupportedTypeError or UnsupportedValueError
|
||||
// so no need to check here
|
||||
body, _ := json.Marshal(param)
|
||||
body, err := json.Marshal(param)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_, resp, err := c.do("POST", u, "application/json", bytes.NewReader(body))
|
||||
if err != nil && isNetworkError(err) {
|
||||
_, resp, err = c.do("POST", u, "application/json", bytes.NewReader(body))
|
||||
|
@ -172,7 +172,10 @@ func (l *fileStore) Set(services map[string][]string) error {
|
||||
defer l.mu.Unlock()
|
||||
|
||||
// no error will return from memorystore.set
|
||||
_ = l.memoryStore.Set(services)
|
||||
err := l.memoryStore.Set(services)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
f, err := os.OpenFile(l.persistentFile, os.O_TRUNC|os.O_WRONLY|os.O_CREATE, 0600)
|
||||
if err != nil {
|
||||
@ -191,8 +194,7 @@ func (l *fileStore) Set(services map[string][]string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
_ = f.Sync()
|
||||
return nil
|
||||
return f.Sync()
|
||||
}
|
||||
|
||||
func (l *fileStore) appendToFile(s ServiceUnderTest) error {
|
||||
|
Loading…
Reference in New Issue
Block a user