summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2014-02-07 11:20:09 -0800
committerdanielsdeleo <dan@opscode.com>2014-02-07 11:20:09 -0800
commit29e732d97ec7e28b2111aca9f93edfd1bc257c2d (patch)
treea05a3ec70af80f9ae06b1c2822257b1c9b10213b /lib/chef
parentcfca4a26fde79b209542930405026aef1a5a16bb (diff)
parenteeae85b44267c4147ed38f19ef8c4c5d30919198 (diff)
downloadchef-29e732d97ec7e28b2111aca9f93edfd1bc257c2d.tar.gz
Merge branch 'nomethod-gobbling'
Fixes https://tickets.opscode.com/browse/CHEF-5011
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/dsl/recipe.rb12
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)