Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _None_

### New Features

_None_
- Propose to retry when the download of GlotPress translations failed for a locale (especially useful for occurrences of `429 - Too Many Requests` quota limits) [#402]

### Bug Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ def self.download_glotpress_export_file(project_url:, locale:, filters:)
uri.open(options) { |f| Nokogiri::XML(f.read.gsub("\t", ' '), nil, Encoding::UTF_8.to_s) }
rescue StandardError => e
UI.error "Error downloading #{locale} - #{e.message}"
retry if e.is_a?(OpenURI::HTTPError) && UI.confirm("Retry downloading `#{locale}`?")
return nil
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def self.download_glotpress_export_file(project_url:, locale:, filters:, destina
IO.copy_stream(uri.open(options), destination)
rescue StandardError => e
UI.error "Error downloading locale `#{locale}` — #{e.message} (#{uri})"
retry if e.is_a?(OpenURI::HTTPError) && UI.confirm("Retry downloading `#{locale}`?")
return nil
end
end
Expand Down
1 change: 1 addition & 0 deletions spec/ios_download_strings_files_from_glotpress_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def test_gp_download(filters:, tablename:, expected_gp_params:)
stub = gp_stub(locale: 'unknown-locale', query: { 'filters[status]': 'current', format: 'strings' }).to_return(status: [404, 'Not Found'])
error_messages = []
allow(FastlaneCore::UI).to receive(:error) { |message| error_messages.append(message) }
allow(FastlaneCore::UI).to receive(:confirm).and_return(false) # as we will be asked if we want to retry when getting a network error

# Act
run_described_fastlane_action(
Expand Down
1 change: 1 addition & 0 deletions spec/ios_l10n_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ def file_encoding(path)
stub = stub_request(:get, "#{gp_fake_url}/invalid/default/export-translations/").with(query: { format: 'strings' }).to_return(status: [404, 'Not Found'])
error_messages = []
allow(FastlaneCore::UI).to receive(:error) { |message| error_messages.append(message) }
allow(FastlaneCore::UI).to receive(:confirm).and_return(false) # as we will be asked if we want to retry when getting a network error
dest = StringIO.new
# Act
described_class.download_glotpress_export_file(project_url: gp_fake_url, locale: 'invalid', filters: nil, destination: dest)
Expand Down