Skip to content

Commit

Permalink
Merge pull request #314 from aaronjensen/fix-error-cause-pollution
Browse files Browse the repository at this point in the history
Prevent FallbackScan from polluting exception cause
  • Loading branch information
burke committed Aug 5, 2020
2 parents d7f33a6 + 29b77ee commit b1096d1
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/bootsnap/load_path_cache/core_ext/kernel_require.rb
Expand Up @@ -38,7 +38,11 @@ def require(path)
rescue Bootsnap::LoadPathCache::ReturnFalse
false
rescue Bootsnap::LoadPathCache::FallbackScan
require_with_bootsnap_lfi(path)
fallback = true
ensure
if fallback
require_with_bootsnap_lfi(path)
end
end

alias_method(:require_relative_without_bootsnap, :require_relative)
Expand Down Expand Up @@ -67,7 +71,11 @@ def load(path, wrap = false)
rescue Bootsnap::LoadPathCache::ReturnFalse
false
rescue Bootsnap::LoadPathCache::FallbackScan
load_without_bootsnap(path, wrap)
fallback = true
ensure
if fallback
load_without_bootsnap(path, wrap)
end
end
end

Expand All @@ -88,6 +96,10 @@ def autoload(const, path)
rescue Bootsnap::LoadPathCache::ReturnFalse
false
rescue Bootsnap::LoadPathCache::FallbackScan
autoload_without_bootsnap(const, path)
fallback = true
ensure
if fallback
autoload_without_bootsnap(const, path)
end
end
end

0 comments on commit b1096d1

Please sign in to comment.