diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-03-14 15:44:08 -0700 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-03-20 14:38:05 -0700 |
commit | 31c218ce09ead9036c033b868571a4d4dd75b110 (patch) | |
tree | 129c4705a5d7b037071e90ed543fe8ecf3725f3b /lib/chef/exceptions.rb | |
parent | 34b0725c7328aad2d0542fc95bb12e352101ae94 (diff) | |
download | chef-31c218ce09ead9036c033b868571a4d4dd75b110.tar.gz |
ResourceStore does not deal with exceptions
Also, added a more specific exception for when we cannot
find the resource
Diffstat (limited to 'lib/chef/exceptions.rb')
-rw-r--r-- | lib/chef/exceptions.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb index 22f090789f..eea6a2f239 100644 --- a/lib/chef/exceptions.rb +++ b/lib/chef/exceptions.rb @@ -442,5 +442,20 @@ class Chef super "PID file and lockfile are not permitted to match. Specify a different location with --pid or --lockfile" end end + + class MultipleDscResourcesFound < RuntimeError + attr_reader :resources_found + def initialize(resources_found) + @resources_found = resources_found + matches_info = @resources_found.each do |r| + if r['Module'].nil? + "Resource #{r['Name']} was found in #{r['Module']['Name']}" + else + "Resource #{r['Name']} is a binary resource" + end + end + super "Found multiple matching resources. #{matches_info.join("\n")}" + end + end end end |