Skip to content

Commit

Permalink
Add temp codes when determining if an error is 'Temporary' (#1115)
Browse files Browse the repository at this point in the history
Authored-by: Dennis Leon <leonde@vmware.com>
  • Loading branch information
DennisDenuto committed Sep 8, 2021
1 parent c5dea0c commit 8388fde
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/v1/remote/transport/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,22 @@ const (
DeniedErrorCode ErrorCode = "DENIED"
UnsupportedErrorCode ErrorCode = "UNSUPPORTED"
TooManyRequestsErrorCode ErrorCode = "TOOMANYREQUESTS"
UnknownErrorCode ErrorCode = "UNKNOWN"
)

// TODO: Include other error types.
var temporaryErrorCodes = map[ErrorCode]struct{}{
BlobUploadInvalidErrorCode: {},
TooManyRequestsErrorCode: {},
UnknownErrorCode: {},
}

var temporaryStatusCodes = map[int]struct{}{
http.StatusRequestTimeout: {},
http.StatusInternalServerError: {},
http.StatusBadGateway: {},
http.StatusServiceUnavailable: {},
http.StatusGatewayTimeout: {},
}

// CheckError returns a structured error if the response status is not in codes.
Expand Down

0 comments on commit 8388fde

Please sign in to comment.