spaceship/lib/spaceship/connect_api/api_client.rb in fastlane-2.162.0 vs spaceship/lib/spaceship/connect_api/api_client.rb in fastlane-2.163.0
- old
+ new
@@ -150,20 +150,25 @@
protected
def with_asc_retry(tries = 5, &_block)
tries = 1 if Object.const_defined?("SpecHelper")
+
response = yield
status = response.status if response
if [500, 504].include?(status)
msg = "Timeout received! Retrying after 3 seconds (remaining: #{tries})..."
raise msg
end
return response
+ rescue UnauthorizedAccessError => error
+ # Catch unathorized access and re-raising
+ # There is no need to try again
+ raise error
rescue => error
tries -= 1
puts(error) if Spaceship::Globals.verbose?
if tries.zero?
return response
@@ -190,9 +195,13 @@
raise UnexpectedResponse, "Temporary App Store Connect error: #{response.body}" if response.body['statusCode'] == 'ERROR'
store_csrf_tokens(response)
return Spaceship::ConnectAPI::Response.new(body: response.body, status: response.status, client: self)
+ end
+
+ def handle_401(response)
+ raise UnauthorizedAccessError, handle_errors(response) if response && (response.body || {})['errors']
end
def handle_errors(response)
# Example error format
# {