From 8322ea45c1087325fd428a201749791550bc7859 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 20 Feb 2005 20:55:36 +0000 Subject: Blame controller files #684 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@718 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/lib/active_support/dependencies.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 09fb7cd90c..c00f5b374e 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -109,7 +109,11 @@ module Dependencies # Load the source file at the given file path def load_file!(file_path) - root.module_eval(IO.read(file_path), file_path, 1) + begin root.module_eval(IO.read(file_path), file_path, 1) + rescue Object => exception + exception.blame_file! file_path + raise + end end # Erase all items in this module @@ -197,10 +201,12 @@ class Exception (@blamed_files ||= []).unshift file end - attr_reader :blamed_files + def blamed_files + @blamed_files ||= [] + end def describe_blame return nil if blamed_files.empty? - "This error occured while loading the following files:\n #{blamed_files.join '\n '}" + "This error occured while loading the following files:\n #{blamed_files.join "\n "}" end -end \ No newline at end of file +end -- cgit v1.2.3