Skip to content

Commit b906a2a

Browse files
authored
Merge pull request #1847 from amacaskill/more-op-err-codes
Map RESOURCE_OPERATION_RATE_EXCEEDED to ResourceExhausted
2 parents 427d91c + 4aa28aa commit b906a2a

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

pkg/gce-cloud-provider/compute/gce-compute.go

+1
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,7 @@ func codeForGCEOpError(err computev1.OperationErrorErrors) codes.Code {
12441244
"RATE_LIMIT_EXCEEDED": codes.ResourceExhausted,
12451245
"INVALID_USAGE": codes.InvalidArgument,
12461246
"UNSUPPORTED_OPERATION": codes.InvalidArgument,
1247+
"RESOURCE_OPERATION_RATE_EXCEEDED": codes.ResourceExhausted,
12471248
}
12481249
if code, ok := userErrors[err.Code]; ok {
12491250
return code

pkg/gce-cloud-provider/compute/gce-compute_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ func TestCodeForGCEOpError(t *testing.T) {
164164
inputErr: computev1.OperationErrorErrors{Code: "UNSUPPORTED_OPERATION"},
165165
expCode: codes.InvalidArgument,
166166
},
167+
{
168+
name: "RESOURCE_OPERATION_RATE_EXCEEDED error",
169+
inputErr: computev1.OperationErrorErrors{Code: "RESOURCE_OPERATION_RATE_EXCEEDED"},
170+
expCode: codes.ResourceExhausted,
171+
},
167172
}
168173

169174
for _, tc := range testCases {

0 commit comments

Comments
 (0)