Define EtcdErrorCode as constant and reuse EtcdError instances

This commit is contained in:
Kouhei Ueno
2014-07-15 20:48:06 +09:00
parent 314eb1ae2d
commit bba23e28c2
5 changed files with 28 additions and 26 deletions

View File

@@ -36,7 +36,7 @@ func TestIsNotFoundErr(t *testing.T) {
t.Errorf("Expected %#v to return %v, but it did not", err, isNotFound)
}
}
try(&etcd.EtcdError{ErrorCode: 100}, true)
try(EtcdErrorNotFound, true)
try(&etcd.EtcdError{ErrorCode: 101}, false)
try(nil, false)
try(fmt.Errorf("some other kind of error"), false)