Skip to content

Commit d1cda1e

Browse files
oliwermjuraga
authored andcommitted
REORG/MINOR: client-native configuration API changes
The API of `configuration.ConfError` has changed in client-native 2.9.
1 parent 514233d commit d1cda1e

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

discovery/aws_service_discovery_instance.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func (a *awsInstance) start() {
189189
if err = a.updateServices(api); err != nil {
190190
switch t := err.(type) {
191191
case *configuration.ConfError:
192-
switch t.Code() {
192+
switch t.Err() {
193193
case configuration.ErrObjectAlreadyExists:
194194
continue
195195
default:

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ require (
2222
github.com/go-openapi/validate v0.22.1
2323
github.com/google/renameio v1.0.1
2424
github.com/google/uuid v1.3.1
25-
github.com/haproxytech/client-native/v5 v5.0.1-0.20230921091007-23efe063cddc
25+
github.com/haproxytech/client-native/v5 v5.0.1-0.20231011083306-519f1b08727d
2626
github.com/haproxytech/config-parser/v5 v5.0.1-0.20230913105857-585d83cb48ba
2727
github.com/jessevdk/go-flags v1.5.0
2828
github.com/json-iterator/go v1.1.12

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ github.com/google/renameio v1.0.1/go.mod h1:t/HQoYBZSsWSNK35C6CO/TpPLDVWvxOHboWU
133133
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
134134
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
135135
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
136-
github.com/haproxytech/client-native/v5 v5.0.1-0.20230921091007-23efe063cddc h1:xo21KZBRB0R5Q4lQFnFWaUt3pSWNYRpM41xv8LmY6UY=
137-
github.com/haproxytech/client-native/v5 v5.0.1-0.20230921091007-23efe063cddc/go.mod h1:hJEZYIr/vXYKZDLHZXqZIncYJwvQ3evKyQ1xgEtQwhs=
136+
github.com/haproxytech/client-native/v5 v5.0.1-0.20231011083306-519f1b08727d h1:AKVD4wYLkrsFDsdAe1zFhkl6UlkP/tKnsR6Pd9PdwEg=
137+
github.com/haproxytech/client-native/v5 v5.0.1-0.20231011083306-519f1b08727d/go.mod h1:hJEZYIr/vXYKZDLHZXqZIncYJwvQ3evKyQ1xgEtQwhs=
138138
github.com/haproxytech/config-parser/v5 v5.0.1-0.20230913105857-585d83cb48ba h1:l4oTCSr7nrZ9vZ7VVJ5GX64BRtZLuD9ePG8B5clbjHI=
139139
github.com/haproxytech/config-parser/v5 v5.0.1-0.20230913105857-585d83cb48ba/go.mod h1:ASOyT1KguwXaY0NfoLNjLLs0OlnYHnFgUJsdJe6NhZg=
140140
github.com/haproxytech/go-logger v1.1.0 h1:HgGtYaI1ApkvbQdsm7f9AzQQoxTB7w37criTflh7IQE=

misc/misc.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func HandleError(err error) *models.Error {
7878
case *configuration.ConfError:
7979
msg := t.Error()
8080
httpCode := ErrHTTPInternalServerError
81-
switch t.Code() {
81+
switch t.Err() {
8282
case configuration.ErrObjectDoesNotExist:
8383
httpCode = ErrHTTPNotFound
8484
case configuration.ErrObjectAlreadyExists, configuration.ErrVersionMismatch, configuration.ErrTransactionAlreadyExists:
@@ -107,7 +107,7 @@ func HandleError(err error) *models.Error {
107107
// HandleContainerGetError translates error codes from client native into models.Error with appropriate http status code. Intended for get requests on container endpoints.
108108
func HandleContainerGetError(err error) *models.Error {
109109
if t, ok := err.(*configuration.ConfError); ok {
110-
if t.Code() == configuration.ErrParentDoesNotExist {
110+
if t.Is(configuration.ErrParentDoesNotExist) {
111111
code := ErrHTTPOk
112112
return &models.Error{Code: &code}
113113
}
@@ -192,7 +192,7 @@ func ParseTimeout(tOut string) *int64 {
192192
}
193193

194194
func GetHTTPStatusFromConfErr(err *configuration.ConfError) int {
195-
switch err.Code() {
195+
switch err.Err() {
196196
case configuration.ErrObjectDoesNotExist:
197197
return http.StatusNotFound
198198
case configuration.ErrObjectAlreadyExists:

0 commit comments

Comments
 (0)