Skip to content

Commit 804c1f8

Browse files
committed
fix: add exception handling to hermes-utils.rb
1 parent 6f4e7ec commit 804c1f8

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

packages/react-native/sdks/hermes-engine/hermes-utils.rb

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -292,18 +292,22 @@ def nightly_tarball_url(version)
292292
artifact_name = "hermes-ios-debug.tar.gz"
293293
xml_url = "https://central.sonatype.com/repository/maven-snapshots/com/facebook/react/#{artifact_coordinate}/#{version}-SNAPSHOT/maven-metadata.xml"
294294

295-
response = Net::HTTP.get_response(URI(xml_url))
296-
if response.is_a?(Net::HTTPSuccess)
297-
xml = REXML::Document.new(response.body)
298-
timestamp = xml.elements['metadata/versioning/snapshot/timestamp'].text
299-
build_number = xml.elements['metadata/versioning/snapshot/buildNumber'].text
300-
full_version = "#{version}-#{timestamp}-#{build_number}"
301-
final_url = "https://central.sonatype.com/repository/maven-snapshots/com/facebook/react/#{artifact_coordinate}/#{version}-SNAPSHOT/#{artifact_coordinate}-#{full_version}-#{artifact_name}"
302-
303-
return final_url
304-
else
295+
begin # [macOS add exception handling
296+
response = Net::HTTP.get_response(URI(xml_url))
297+
if response.is_a?(Net::HTTPSuccess)
298+
xml = REXML::Document.new(response.body)
299+
timestamp = xml.elements['metadata/versioning/snapshot/timestamp'].text
300+
build_number = xml.elements['metadata/versioning/snapshot/buildNumber'].text
301+
full_version = "#{version}-#{timestamp}-#{build_number}"
302+
final_url = "https://central.sonatype.com/repository/maven-snapshots/com/facebook/react/#{artifact_coordinate}/#{version}-SNAPSHOT/#{artifact_coordinate}-#{full_version}-#{artifact_name}"
303+
304+
return final_url
305+
else
306+
return ""
307+
end
308+
rescue => e
305309
return ""
306-
end
310+
end # macOS]
307311
end
308312

309313
def resolve_url_redirects(url)

0 commit comments

Comments
 (0)