Skip to content

Commit 17d184c

Browse files
Saadnajmimeta-codesync[bot]
authored andcommitted
fix: add exception handling to hermes-utils.rb (#54411)
Summary: While working on the React Native macOS upgrade, I ran into this error while fetching hermes during `pod install` ``` Fetching podspec for `hermes-engine` from `../react-native/sdks/hermes-engine/hermes-engine.podspec` [!] Failed to load 'hermes-engine' podspec: [!] Invalid `hermes-engine.podspec` file: SSL_connect returned=1 errno=0 peeraddr=52.41.8.25:443 state=error: certificate verify failed (unable to get certificate CRL). # from /Users/sanajmi/Developer/react-native-macos/packages/react-native/sdks/hermes-engine/hermes-engine.podspec:26 ``` It seemed this simply came from an exception in `nightly_tarball_url`, which would stop the process. This change adds a fallback so that `pod install` can continue. bypass-github-export-checks ## Changelog: [INTERNAL] [FIXED] - add exception handling to hermes-utils.rb Pull Request resolved: #54411 Test Plan: CI should pass Reviewed By: cipolleschi Differential Revision: D86225597 Pulled By: sbuggay fbshipit-source-id: 3988dd5fdf199b719b9946234f865b2a4de389f8
1 parent ef3a858 commit 17d184c

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

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

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -256,16 +256,20 @@ def nightly_tarball_url(version)
256256

257257
xml_url = "https://central.sonatype.com/repository/maven-snapshots/#{namespace}/#{artifact_coordinate}/#{version}-SNAPSHOT/maven-metadata.xml"
258258

259-
response = Net::HTTP.get_response(URI(xml_url))
260-
if response.is_a?(Net::HTTPSuccess)
261-
xml = REXML::Document.new(response.body)
262-
timestamp = xml.elements['metadata/versioning/snapshot/timestamp'].text
263-
build_number = xml.elements['metadata/versioning/snapshot/buildNumber'].text
264-
full_version = "#{version}-#{timestamp}-#{build_number}"
265-
final_url = "https://central.sonatype.com/repository/maven-snapshots/#{namespace}/#{artifact_coordinate}/#{version}-SNAPSHOT/#{artifact_coordinate}-#{full_version}-#{artifact_name}"
266-
267-
return final_url
268-
else
259+
begin
260+
response = Net::HTTP.get_response(URI(xml_url))
261+
if response.is_a?(Net::HTTPSuccess)
262+
xml = REXML::Document.new(response.body)
263+
timestamp = xml.elements['metadata/versioning/snapshot/timestamp'].text
264+
build_number = xml.elements['metadata/versioning/snapshot/buildNumber'].text
265+
full_version = "#{version}-#{timestamp}-#{build_number}"
266+
final_url = "https://central.sonatype.com/repository/maven-snapshots/#{namespace}/#{artifact_coordinate}/#{version}-SNAPSHOT/#{artifact_coordinate}-#{full_version}-#{artifact_name}"
267+
268+
return final_url
269+
else
270+
return ""
271+
end
272+
rescue => e
269273
return ""
270274
end
271275
end

0 commit comments

Comments
 (0)