File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
autocodesign/devportalclient/appstoreconnect Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 77 "bytes"
88 "context"
99 "encoding/json"
10+ "errors"
1011 "fmt"
1112 "io"
1213 "net/http"
@@ -78,6 +79,16 @@ func NewRetryableHTTPClient() *http.Client {
7879 return true , nil
7980 }
8081
82+ if resp != nil && resp .StatusCode == http .StatusForbidden {
83+ var apiError * ErrorResponse
84+ if ok := errors .As (checkResponse (resp ), & apiError ); ok {
85+ if apiError .IsRequiredAgreementMissingOrExpired () {
86+ log .Warnf ("Received error FORBIDDEN.REQUIRED_AGREEMENTS_MISSING_OR_EXPIRED (status 403), retrying request..." )
87+ return true , nil
88+ }
89+ }
90+ }
91+
8192 if resp != nil && resp .StatusCode == http .StatusTooManyRequests {
8293 message := "Received HTTP 429 Too Many Requests"
8394 if rateLimit := resp .Header .Get ("X-Rate-Limit" ); rateLimit != "" {
Original file line number Diff line number Diff line change @@ -49,6 +49,22 @@ func (r ErrorResponse) IsCursorInvalid() bool {
4949 return false
5050}
5151
52+ // IsRequiredAgreementMissingOrExpired ...
53+ func (r ErrorResponse ) IsRequiredAgreementMissingOrExpired () bool {
54+ // status code: 403
55+ // code: FORBIDDEN.REQUIRED_AGREEMENTS_MISSING_OR_EXPIRED
56+ // title: A required agreement is missing or has expired.
57+ // detail: This request requires an in-effect agreement that has not been signed or has expired.
58+
59+ for _ , err := range r .Errors {
60+ if err .Code == "FORBIDDEN.REQUIRED_AGREEMENTS_MISSING_OR_EXPIRED" {
61+ return true
62+ }
63+ }
64+
65+ return false
66+ }
67+
5268// DeviceRegistrationError ...
5369type DeviceRegistrationError struct {
5470 Reason string
You can’t perform that action at this time.
0 commit comments