aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/dependencies.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/dependencies.rb')
-rw-r--r--activesupport/lib/active_support/dependencies.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb
index 9518dfab90..a189da189a 100644
--- a/activesupport/lib/active_support/dependencies.rb
+++ b/activesupport/lib/active_support/dependencies.rb
@@ -21,8 +21,6 @@ module Dependencies
require_or_load(file_name)
rescue LoadError
raise unless swallow_load_errors
- rescue Object => e
- raise ScriptError, "#{e.message}"
end
end
end
@@ -179,8 +177,8 @@ class Object #:nodoc:
begin
require_or_load(class_id.to_s.demodulize.underscore)
if Object.const_defined?(class_id) then return Object.const_get(class_id) else raise LoadError end
- rescue LoadError
- raise NameError, "uninitialized constant #{class_id}"
+ rescue LoadError => e
+ raise NameError.new("uninitialized constant #{class_id}").copy_blame!(e)
end
end
end
@@ -216,4 +214,9 @@ class Exception
return nil if blamed_files.empty?
"This error occured while loading the following files:\n #{blamed_files.join "\n "}"
end
+
+ def copy_blame!(exc)
+ @blamed_files = exc.blamed_files.clone
+ self
+ end
end