MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / isRetriableAPIError

Function isRetriableAPIError

app/cli/cmd/errors.go:52–76  ·  view source on GitHub ↗
(err error)

Source from the content-addressed store, hash-verified

50var ErrKeylessNotSupported = errors.New("keyless signing not supported, please provide a private key reference with --key instead")
51
52func isRetriableAPIError(err error) bool {
53 // we retry state conflicts and other transient errors
54 if v1.IsAttestationStateErrorConflict(err) {
55 return true
56 }
57
58 st, ok := status.FromError(err)
59 if !ok {
60 return false
61 }
62
63 retriableCodes := []codes.Code{
64 codes.Unavailable,
65 codes.Internal,
66 codes.DeadlineExceeded,
67 }
68
69 for _, code := range retriableCodes {
70 if st.Code() == code {
71 return true
72 }
73 }
74
75 return false
76}
77
78func runWithBackoffRetry(fn func() error) error {
79 return backoff.RetryNotify(

Callers 1

runWithBackoffRetryFunction · 0.85

Calls 1

Tested by

no test coverage detected