Skip to content
Browse files

Make dependencies.rb add a name to NameError

  • Loading branch information...
1 parent c2d5b31 commit b36df0f6c8e1af0a35b892c72d4ec0fbd30ec3ab @arthurnn arthurnn committed Jun 16, 2014
Showing with 7 additions and 4 deletions.
  1. +3 −0 activesupport/CHANGELOG.md
  2. +4 −4 activesupport/lib/active_support/dependencies.rb
View
3 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*
View
8 activesupport/lib/active_support/dependencies.rb
@@ -187,7 +187,7 @@ def const_missing(const_name)
# 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 @@ def load_missing_constant(from_mod, const_name)
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

0 comments on commit b36df0f

Please sign in to comment.
Something went wrong with that request. Please try again.