aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorArthur Neves <arthurnn@gmail.com>2014-06-16 23:13:42 -0400
committerArthur Neves <arthurnn@gmail.com>2014-06-20 09:44:45 -0400
commitb36df0f6c8e1af0a35b892c72d4ec0fbd30ec3ab (patch)
tree908d6e911a4911cceb74889d67ae21e332c50800 /activesupport
parentc2d5b31073d9e0dbe779a74c0741e3fea79840fa (diff)
downloadrails-b36df0f6c8e1af0a35b892c72d4ec0fbd30ec3ab.tar.gz
rails-b36df0f6c8e1af0a35b892c72d4ec0fbd30ec3ab.tar.bz2
rails-b36df0f6c8e1af0a35b892c72d4ec0fbd30ec3ab.zip
Make dependencies.rb add a name to NameError
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/CHANGELOG.md3
-rw-r--r--activesupport/lib/active_support/dependencies.rb8
2 files changed, 7 insertions, 4 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index d513874aee..d0a5ddcc1e 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -1,3 +1,6 @@
+* Make Dependencies pass a name to NameError error.
+ *arthurnn*
+
* Fixed `ActiveSupport::Cache::FileStore` exploding with long paths.
*Adam Panzer / Michael Grosser*
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb
index 8a545e4386..d7db0d6648 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
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