Skip to content

Commit b1e5e5a

Browse files
committed
Add StatusConflict http kind to userErrorCodeMap
1 parent a13019b commit b1e5e5a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

pkg/common/utils.go

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

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

pkg/common/utils_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -1241,6 +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+
},
12441252
{
12451253
name: "googleapi.Error that wraps apierror.APIError of status kind",
12461254
inputErr: getGoogleAPIWrappedError(status.New(

0 commit comments

Comments
 (0)