lib/active_support/dependencies.rb in activesupport-1.0.2 vs lib/active_support/dependencies.rb in activesupport-1.0.3
- old
+ new
@@ -19,12 +19,10 @@
begin
require_or_load(file_name)
rescue LoadError
raise unless swallow_load_errors
- rescue Object => e
- raise ScriptError, "#{e.message}"
end
end
end
def associate_with(file_name)
@@ -177,12 +175,12 @@
end
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
def load(file, *extras)
@@ -213,7 +211,12 @@
end
def describe_blame
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