diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-20 20:55:36 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-20 20:55:36 +0000 |
commit | 8322ea45c1087325fd428a201749791550bc7859 (patch) | |
tree | 9d49d5c0eb06b8f9d3445d630f8033be87994433 | |
parent | f153f42469ff6d3791e25cdf095986909e679dde (diff) | |
download | rails-8322ea45c1087325fd428a201749791550bc7859.tar.gz rails-8322ea45c1087325fd428a201749791550bc7859.tar.bz2 rails-8322ea45c1087325fd428a201749791550bc7859.zip |
Blame controller files #684
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@718 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 14 |
1 files 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 |