-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
errors.go
36 lines (32 loc) · 932 Bytes
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package s3
import (
argos3 "github.com/argoproj/pkg/s3"
log "github.com/sirupsen/logrus"
"github.com/argoproj/argo-workflows/v3/util/errors"
)
// s3TransientErrorCodes is a list of S3 error codes that are transient (retryable)
// Reference: https://github.com/minio/minio-go/blob/92fe50d14294782d96402deb861d442992038109/retry.go#L90-L102
var s3TransientErrorCodes = []string{
"InternalError",
"RequestTimeout",
"Throttling",
"ThrottlingException",
"RequestLimitExceeded",
"RequestThrottled",
"InternalError",
"SlowDown",
"ServiceUnavailable",
}
// isTransientS3Err checks if an minio.ErrorResponse error is transient (retryable)
func isTransientS3Err(err error) bool {
if err == nil {
return false
}
for _, transientErrCode := range s3TransientErrorCodes {
if argos3.IsS3ErrCode(err, transientErrCode) {
log.Errorf("Transient S3 error: %v", err)
return true
}
}
return errors.IsTransientErr(err)
}