Bug: Crash when a transaction fails due to io issues.

This commit is contained in:
Paul Jack 2018-12-18 10:57:02 -08:00
parent 34de2bdcd5
commit 74b927b622
1 changed files with 2 additions and 3 deletions

View File

@ -15,7 +15,7 @@ type EasyClient struct {
}
func NewClient(conf EasyConfig) (*EasyClient, error) {
config, err := conf.prepare()
config, err := conf.prepare()
if err != nil {
return nil, err
}
@ -119,7 +119,6 @@ func (ez *EasyClient) WatchOnce(key string, timeoutSeconds int) (*Pair, error) {
return nil, errors.New("Timed out watching key.")
}
type Txn struct {
ez *EasyClient
If *Cmps
@ -212,11 +211,11 @@ func (txn *Txn) Commit() error {
t := ez.Client.Txn(ctx)
resp, err := t.If(txn.If.slice...).Then(txn.Then.slice...).Else(txn.Else.slice...).Commit()
cancel()
txn.Success = resp.Succeeded
if err != nil {
txn.Err = err
return err
}
txn.Success = resp.Succeeded
result := make([]*Pair, 0, 4)
for _, r := range resp.Responses {
if rr := r.GetResponseRange(); rr != nil {