提交 99c9d186 编写于 作者: A Aaron Patterson

Wrap up missing helper exceptions

The `path` method on missing helper errors is inconsistent with the
implementation on LoadError in Ruby 2.0.  Wrap up the missing helper
exceptions so that the inconsistent behavior is mirrored in Ruby 2.0
(until we can figure out *why* it's inconsistent).
上级 f278b067
......@@ -135,8 +135,7 @@ def modules_for_helpers(args)
begin
require_dependency(file_name)
rescue LoadError => e
e.instance_variable_set(:@path, "helpers/#{e.path}")
raise
raise MissingHelperError.new(e, file_name)
end
file_name.camelize.constantize
when Module
......@@ -147,6 +146,15 @@ def modules_for_helpers(args)
end
end
class MissingHelperError < LoadError
def initialize(error, path)
@error = error
@path = "helpers/#{path}.rb"
set_backtrace error.backtrace
super("Missing helper file helpers/%s.rb" % error)
end
end
private
# Makes all the (instance) methods in the helper module available to templates
# rendered through this controller.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册