diff --git a/cmd/auth.go b/cmd/auth.go index 34e1d4a2..0a805d74 100644 --- a/cmd/auth.go +++ b/cmd/auth.go @@ -47,7 +47,7 @@ func loginCmd() *cobra.Command { Use: "login", Short: "Login to the App Store", RunE: func(cmd *cobra.Command, args []string) error { - interactive := cmd.Context().Value("interactive").(bool) + interactive := cmd.Context().Value(interactiveKey).(bool) if password == "" && !interactive { return errors.New("password is required when not running in interactive mode; use the \"--password\" flag") diff --git a/pkg/http/client.go b/pkg/http/client.go index 496d02c0..22de26b1 100644 --- a/pkg/http/client.go +++ b/pkg/http/client.go @@ -160,6 +160,10 @@ func (c *client[R]) handleXMLResponse(res *http.Response) (Result[R], error) { return Result[R]{}, fmt.Errorf("failed to read response body: %w", err) } + if res.StatusCode == http.StatusTooManyRequests { + return Result[R]{}, fmt.Errorf("rate limited by Apple (HTTP %d): %s", res.StatusCode, strings.TrimSpace(string(body))) + } + var data R normalizedBody := normalizeXMLPlistBody(body)