diff options
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 |