diff options
author | danielsdeleo <dan@opscode.com> | 2014-02-07 11:20:09 -0800 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2014-02-07 11:20:09 -0800 |
commit | 29e732d97ec7e28b2111aca9f93edfd1bc257c2d (patch) | |
tree | a05a3ec70af80f9ae06b1c2822257b1c9b10213b /lib | |
parent | cfca4a26fde79b209542930405026aef1a5a16bb (diff) | |
parent | eeae85b44267c4147ed38f19ef8c4c5d30919198 (diff) | |
download | chef-29e732d97ec7e28b2111aca9f93edfd1bc257c2d.tar.gz |
Merge branch 'nomethod-gobbling'
Fixes https://tickets.opscode.com/browse/CHEF-5011
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/dsl/recipe.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/chef/dsl/recipe.rb b/lib/chef/dsl/recipe.rb index d8d0b158b3..a3b6a8cef0 100644 --- a/lib/chef/dsl/recipe.rb +++ b/lib/chef/dsl/recipe.rb @@ -55,12 +55,14 @@ class Chef # Otherwise, we're rocking the regular resource call route. declare_resource(method_symbol, args[0], caller[0], &block) else - super + begin + super + rescue NoMethodError + raise NoMethodError, "No resource or method named `#{method_symbol}' for #{describe_self_for_error}" + rescue NameError + raise NameError, "No resource, method, or local variable named `#{method_symbol}' for #{describe_self_for_error}" + end end - rescue NoMethodError - raise NoMethodError, "No resource or method named `#{method_symbol}' for #{describe_self_for_error}" - rescue NameError - raise NameError, "No resource, method, or local variable named `#{method_symbol}' for #{describe_self_for_error}" end def has_resource_definition?(name) |