diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-23 11:48:10 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-23 11:48:10 +0000 |
commit | 3697df1dd2be6e51867bea4d6089f01f8f204f3c (patch) | |
tree | 6d529e1637b88b89d9436531bfef2be33c9b3f02 /actionpack/lib/action_controller/helpers.rb | |
parent | d09e42cfe4b970c03402ab41e3eef95cd32fa4d3 (diff) | |
download | rails-3697df1dd2be6e51867bea4d6089f01f8f204f3c.tar.gz rails-3697df1dd2be6e51867bea4d6089f01f8f204f3c.tar.bz2 rails-3697df1dd2be6e51867bea4d6089f01f8f204f3c.zip |
Improved error reporting especially around never shallowing exceptions. Debugging helpers should be much easier now #980 [Nicholas Seckar]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@984 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/helpers.rb')
-rw-r--r-- | actionpack/lib/action_controller/helpers.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/actionpack/lib/action_controller/helpers.rb b/actionpack/lib/action_controller/helpers.rb index fcfd45a507..1db8a3ceba 100644 --- a/actionpack/lib/action_controller/helpers.rb +++ b/actionpack/lib/action_controller/helpers.rb @@ -52,12 +52,13 @@ module ActionController #:nodoc: when String, Symbol file_name = arg.to_s.underscore + '_helper' class_name = file_name.camelize - + begin require_dependency(file_name) rescue LoadError => load_error requiree = / -- (.*?)(\.rb)?$/.match(load_error).to_a[1] - raise LoadError, requiree == file_name ? "Missing helper file helpers/#{file_name}.rb" : "Can't load file: #{requiree}" + msg = (requiree == file_name) ? "Missing helper file helpers/#{file_name}.rb" : "Can't load file: #{requiree}" + raise LoadError.new(msg).copy_blame!(load_error) end add_template_helper(class_name.constantize) @@ -90,10 +91,9 @@ module ActionController #:nodoc: private def inherited(child) inherited_without_helper(child) - begin - child.helper(child.controller_path) - rescue ArgumentError, LoadError - # No default helper available for this controller + begin child.helper(child.controller_path) + rescue MissingSourceFile => e + raise unless e.path == "helpers/#{child.controller_path}_helper.rb" end end end |