diff options
author | Matthew Draper <matthew@trebex.net> | 2014-06-21 00:09:45 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2014-06-21 00:09:45 +0930 |
commit | 081eec4ba68d161623791d4f6c885ce0d442f31c (patch) | |
tree | d9591075f6c739f90c9b2ae2747e87431f610d78 /activesupport/lib | |
parent | c2d5b31073d9e0dbe779a74c0741e3fea79840fa (diff) | |
parent | bd3fde093112275bef5ab71bfac7ca17e43af8b8 (diff) | |
download | rails-081eec4ba68d161623791d4f6c885ce0d442f31c.tar.gz rails-081eec4ba68d161623791d4f6c885ce0d442f31c.tar.bz2 rails-081eec4ba68d161623791d4f6c885ce0d442f31c.zip |
Merge pull request #15764 from arthurnn/dependencies_name_error
Make dependencies.rb add a name to NameError
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 8a545e4386..a8d12366cc 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -187,7 +187,7 @@ module ActiveSupport #:nodoc: # top-level constant. def guess_for_anonymous(const_name) if Object.const_defined?(const_name) - raise NameError, "#{const_name} cannot be autoloaded from an anonymous class or module" + raise NameError.new "#{const_name} cannot be autoloaded from an anonymous class or module", const_name.to_s else Object end @@ -516,9 +516,9 @@ module ActiveSupport #:nodoc: end end - raise NameError, - "uninitialized constant #{qualified_name}", - caller.reject { |l| l.starts_with? __FILE__ } + name_error = NameError.new("uninitialized constant #{qualified_name}", qualified_name) + name_error.set_backtrace(caller.reject {|l| l.starts_with? __FILE__ }) + raise name_error end # Remove the constants that have been autoloaded, and those that have been |