diff --git a/pkg/statuscodes/statuscode_string.go b/pkg/statuscodes/statuscode_string.go index 9962475f..53c25e67 100644 --- a/pkg/statuscodes/statuscode_string.go +++ b/pkg/statuscodes/statuscode_string.go @@ -20,17 +20,18 @@ func _() { _ = x[NotImplemented-801] _ = x[Unavailable-802] _ = x[UnknownError-803] + _ = x[DeadlineExceeded-804] } const ( _StatusCode_name_0 = "OK" _StatusCode_name_1 = "BadRequestUnauthorizedForbiddenNotFoundConflictRateLimitedClientConnectionSevered" - _StatusCode_name_2 = "InternalServerErrorNotImplementedUnavailableUnknownError" + _StatusCode_name_2 = "InternalServerErrorNotImplementedUnavailableUnknownErrorDeadlineExceeded" ) var ( _StatusCode_index_1 = [...]uint8{0, 10, 22, 31, 39, 47, 58, 81} - _StatusCode_index_2 = [...]uint8{0, 19, 33, 44, 56} + _StatusCode_index_2 = [...]uint8{0, 19, 33, 44, 56, 72} ) func (i StatusCode) String() string { @@ -40,7 +41,7 @@ func (i StatusCode) String() string { case 700 <= i && i <= 706: i -= 700 return _StatusCode_name_1[_StatusCode_index_1[i]:_StatusCode_index_1[i+1]] - case 800 <= i && i <= 803: + case 800 <= i && i <= 804: i -= 800 return _StatusCode_name_2[_StatusCode_index_2[i]:_StatusCode_index_2[i+1]] default: diff --git a/pkg/statuscodes/statuscodes.go b/pkg/statuscodes/statuscodes.go index 948df42f..4b7fa52b 100644 --- a/pkg/statuscodes/statuscodes.go +++ b/pkg/statuscodes/statuscodes.go @@ -68,6 +68,9 @@ const ( // Deprecated: In reality server-side errors should fall into one of the above 3 errors, and this inclusion was // a mistake. It's not worth a breaking change to revoke at this time, though, so it shall live on. UnknownError StatusCode = 803 + // DeadlineExceeded is for when the server is unable to complete the request within the configured deadline and the + // request times out. This error is retriable, but the duration for backoff is unknown. + DeadlineExceeded StatusCode = 804 ) //go:generate ../../scripts/shell-wrapper.sh gobin.sh golang.org/x/tools/cmd/stringer@v0.1.12 -type=StatusCode @@ -136,6 +139,8 @@ func FromString(s string) (StatusCode, bool) { return Unavailable, true case UnknownError.String(): return UnknownError, true + case DeadlineExceeded.String(): + return DeadlineExceeded, true default: return UnknownError, false } diff --git a/pkg/statuscodes/statuscodes_test.go b/pkg/statuscodes/statuscodes_test.go index 914ef213..ec72d7ee 100644 --- a/pkg/statuscodes/statuscodes_test.go +++ b/pkg/statuscodes/statuscodes_test.go @@ -16,6 +16,7 @@ func TestStatusCodeUnmarshalText(t *testing.T) { NotImplemented, Unavailable, UnknownError, + DeadlineExceeded, } for _, code := range codes {