@@ -110,11 +110,14 @@ def parsed_package_json
110110
111111 sig { returns ( T ::Hash [ Symbol , T . nilable ( Dependabot ::DependencyFile ) ] ) }
112112 def lockfiles_hash
113- {
114- npm : dependency_files . find { |f | f . name . end_with? ( NpmPackageManager ::LOCKFILE_NAME ) } ,
115- yarn : dependency_files . find { |f | f . name . end_with? ( YarnPackageManager ::LOCKFILE_NAME ) } ,
116- pnpm : dependency_files . find { |f | f . name . end_with? ( PNPMPackageManager ::LOCKFILE_NAME ) }
117- }
113+ @lockfiles_hash ||= T . let (
114+ {
115+ npm : dependency_files . find { |f | f . name . end_with? ( NpmPackageManager ::LOCKFILE_NAME ) } ,
116+ yarn : dependency_files . find { |f | f . name . end_with? ( YarnPackageManager ::LOCKFILE_NAME ) } ,
117+ pnpm : dependency_files . find { |f | f . name . end_with? ( PNPMPackageManager ::LOCKFILE_NAME ) }
118+ } ,
119+ T . nilable ( T ::Hash [ Symbol , T . nilable ( Dependabot ::DependencyFile ) ] )
120+ )
118121 end
119122
120123 sig { returns ( String ) }
@@ -161,6 +164,7 @@ def inject_ephemeral_lockfile(ephemeral_lockfile)
161164
162165 # Clear our cached lockfile reference so it picks up the new one
163166 remove_instance_variable ( :@lockfile ) if instance_variable_defined? ( :@lockfile )
167+ remove_instance_variable ( :@lockfiles_hash ) if instance_variable_defined? ( :@lockfiles_hash )
164168
165169 # Clear the FileParser's memoized lockfile references so it will
166170 # find the newly injected lockfile when parse is called
@@ -237,6 +241,11 @@ def package_relationships
237241 fetch_package_relationships ,
238242 T . nilable ( T ::Hash [ String , T ::Array [ String ] ] )
239243 )
244+ rescue StandardError => e
245+ errored_fetching_subdependencies!
246+ @subdependency_error = T . let ( e , T . nilable ( StandardError ) )
247+ Dependabot . logger . error ( "Error fetching subdependencies: #{ e . message } " )
248+ @package_relationships = { }
240249 end
241250
242251 sig { returns ( T ::Hash [ String , T ::Array [ String ] ] ) }
0 commit comments