Skip to content

Commit 954f406

Browse files
committed
Add StatusConflict http kind to userErrorCodeMap
1 parent 7a88b83 commit 954f406

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

pkg/common/utils.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ var (
9898
http.StatusBadRequest: codes.InvalidArgument,
9999
http.StatusTooManyRequests: codes.ResourceExhausted,
100100
http.StatusNotFound: codes.NotFound,
101-
// http.StatusConflict: codes.FailedPrecondition,
101+
http.StatusConflict: codes.FailedPrecondition,
102102
}
103103

104104
// Regular expressions for validating parent_id, key and value of a resource tag.

pkg/common/utils_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -1241,14 +1241,14 @@ func TestCodeForError(t *testing.T) {
12411241
}),
12421242
expCode: codes.NotFound,
12431243
},
1244-
// {
1245-
// name: "googleapi.Error that wraps apierror.APIError of http kind status conflict",
1246-
// inputErr: getGoogleAPIWrappedError(&googleapi.Error{
1247-
// Code: 409,
1248-
// Message: "status conflict error",
1249-
// }),
1250-
// expCode: codes.FailedPrecondition,
1251-
// },
1244+
{
1245+
name: "googleapi.Error that wraps apierror.APIError of http kind status conflict",
1246+
inputErr: getGoogleAPIWrappedError(&googleapi.Error{
1247+
Code: 409,
1248+
Message: "status conflict error",
1249+
}),
1250+
expCode: codes.FailedPrecondition,
1251+
},
12521252
{
12531253
name: "googleapi.Error that wraps apierror.APIError of status kind",
12541254
inputErr: getGoogleAPIWrappedError(status.New(

0 commit comments

Comments
 (0)