use go-multierror instead of manually joining error reasons

Co-authored-by: Chris Thain <32781396+cthain@users.noreply.github.com>
pull/33108/head
Roberto Hidalgo 3 years ago committed by GitHub
parent 1b7f772f8b
commit 787cc693cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -231,11 +231,11 @@ func (c *RemoteClient) Put(data []byte) error {
}
// transaction was rolled back
if !ok {
message := ""
var resultErr error
for _, respError := range resp.Errors {
message += respError.What
resultErr = append(resultErr, errors.New(respError.What))
}
return fmt.Errorf("consul CAS failed with transaction errors: %s", message)
return fmt.Errorf("consul CAS failed with transaction errors: %w", resultErr)
}
if len(resp.Results) != 1 {

Loading…
Cancel
Save