lib/percheron/validators/container.rb in percheron-0.5.0 vs lib/percheron/validators/container.rb in percheron-0.6.0
- old
+ new
@@ -8,18 +8,26 @@
def valid?
message = rules.return { |rule| send(rule) }
if message
- raise Errors::ContainerInvalid.new(message)
+ raise Errors::ContainerInvalid.new(formatted_message(message))
else
true
end
end
private
attr_reader :container
+
+ def formatted_message(message)
+ if container.name
+ "Container config for '%s' is invalid: %s" % [ container.name, message ]
+ else
+ "Container config is invalid: %s" % [ message ]
+ end
+ end
def rules
[
:validate_name,
:validate_version,