More descriptive Redis errors (#19)

This commit is contained in:
Yaron Schneider 2019-09-30 13:02:30 -07:00 committed by GitHub
parent ad1d4aaec2
commit ec74d90bf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -196,13 +196,13 @@ func (r *StateStore) setValue(req *state.SetRequest) error {
res := r.client.Do(context.Background(), "EVAL", setQuery, 1, req.Key, ver, b)
if err := redis.AsError(res); err != nil {
return fmt.Errorf("failed to set key '%s' due to ETag mismatch", req.Key)
return fmt.Errorf("failed to set key %s: %s", req.Key, err)
}
if req.Options.Consistency == state.Strong && r.replicas > 0 {
res = r.client.Do(context.Background(), "WAIT", r.replicas, 1000)
if err := redis.AsError(res); err != nil {
return fmt.Errorf("timed out while wating for %d replicas to acknowledge", r.replicas)
return fmt.Errorf("timed out while waiting for %v replicas to acknowledge write", r.replicas)
}
}