diff --git a/CHANGELOG.md b/CHANGELOG.md index be20d160..edcd3034 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,10 @@ # Changelog -## v3.4.23 (unreleased) - - no changes yet, +## v3.4.24 (unreleased) + - no changes yet. + +## v3.4.23 (2020-04-22) + - Do not discard errors returned by the Gateway (for Read and CreateIfNotExists). ## v3.4.22 (2020-04-17) - Add some String() methods to query-related objects diff --git a/connectors/yarpc/yarpc.go b/connectors/yarpc/yarpc.go index ecd63082..dbcfb9f3 100644 --- a/connectors/yarpc/yarpc.go +++ b/connectors/yarpc/yarpc.go @@ -24,6 +24,7 @@ import ( "context" "encoding/json" "fmt" + nethttp "net/http" "net/url" "strings" @@ -44,8 +45,8 @@ import ( const ( _version = "version" - errCodeNotFound int32 = 404 - errCodeAlreadyExists int32 = 409 + errCodeNotFound int32 = nethttp.StatusNotFound + errCodeAlreadyExists int32 = nethttp.StatusConflict errConnectionRefused string = "getsockopt: connection refused" httpTransport string = "http" tchannelTransport string = "tchannel" @@ -216,10 +217,9 @@ func (c *Connector) CreateIfNotExists(ctx context.Context, ei *dosa.EntityInfo, if err != nil { if be, ok := err.(*dosarpc.BadRequestError); ok { if be.ErrorCode != nil && *be.ErrorCode == errCodeAlreadyExists { - return errors.Wrap(&dosa.ErrAlreadyExists{}, "CreateIfNotExists failed") + return errors.Wrap(&dosa.ErrAlreadyExists{}, err.Error()) } } - if !dosarpc.Dosa_CreateIfNotExists_Helper.IsException(err) { return errors.Wrap(err, "CreateIfNotExists failed due to network issue") } @@ -329,7 +329,7 @@ func (c *Connector) Read(ctx context.Context, ei *dosa.EntityInfo, keys map[stri if err != nil { if be, ok := err.(*dosarpc.BadRequestError); ok { if be.ErrorCode != nil && *be.ErrorCode == errCodeNotFound { - return nil, errors.Wrap(&dosa.ErrNotFound{}, "Read failed: not found") + return nil, errors.Wrap(&dosa.ErrNotFound{}, err.Error()) } } diff --git a/version.go b/version.go index 716165f0..b7fc58bb 100644 --- a/version.go +++ b/version.go @@ -21,4 +21,4 @@ package dosa // VERSION indicates the dosa client version -const VERSION = "3.4.22" +const VERSION = "3.4.23"