lib/berkshelf/errors.rb in berkshelf-0.6.0.beta2 vs lib/berkshelf/errors.rb in berkshelf-0.6.0.beta3
- old
+ new
@@ -78,6 +78,26 @@
@original_error.respond_to?(:status_code) ? @original_error.status_code : 113
end
end
class AmbiguousCookbookName < BerkshelfError; status_code(114); end
+
+ class InvalidConfiguration < BerkshelfError
+ status_code(115)
+
+ def initialize(errors)
+ @errors = errors
+ end
+
+ def to_s
+ strings = ["Invalid configuration:"]
+
+ @errors.messages.each do |key, errors|
+ errors.each do |error|
+ strings << " #{key} #{error}"
+ end
+ end
+
+ strings.join "\n"
+ end
+ end
end