From 87cb1fd871478c972ae0edc6ec22c3fa3f6a131b Mon Sep 17 00:00:00 2001 From: Brandon Dunne Date: Wed, 9 Jan 2019 12:42:22 -0500 Subject: [PATCH] Re-raise the LoadError if it is not for the file we are trying to load Previously this could mask LoadErrors when the file we are trying to load is found and loaded, but it requires another file which is not found, raises LoadError and incorrectly runs the code in the rescue block. --- lib/extensions/as_include_concern.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/extensions/as_include_concern.rb b/lib/extensions/as_include_concern.rb index 6e555ad530a..b4d336935e7 100644 --- a/lib/extensions/as_include_concern.rb +++ b/lib/extensions/as_include_concern.rb @@ -49,7 +49,8 @@ def include_concern(mod) begin to_include = "#{name}::#{mod}" require_dependency to_include.underscore - rescue LoadError + rescue LoadError => err + raise unless err.message.include?(to_include.underscore) to_include = mod require_dependency to_include.underscore end