lib/render/errors.rb in render-0.0.8 vs lib/render/errors.rb in render-0.0.9

- old
+ new

@@ -38,22 +38,49 @@ "No value for key #{config_key} found in config or parental_properties." end end end - class DefinitionNotFound < StandardError - attr_accessor :title + module Definition + class NoId < StandardError + attr_accessor :definition - def initialize(title) - self.title = title + def initialize(definition) + self.definition = definition + end + + def to_s + "id keyword must be used to differentiate loaded schemas -- none found in: #{definition}" + end end - def to_s - "Schema with title #{title} is not loaded" + class NotFound < StandardError + attr_accessor :title + + def initialize(title) + self.title = title + end + + def to_s + "Schema with title #{title} is not loaded" + end end end class Schema + class InvalidRequire < StandardError + attr_accessor :schema_definition + + def initialize(schema_definition) + self.schema_definition = schema_definition + end + + def to_s + required_attributes = schema_definition.fetch(:required, []) + "Could not require the following attributes: #{required_attributes}. This should be an array of attributes for #{schema_definition}" + end + end + class RequestError < StandardError attr_accessor :endpoint, :response def initialize(endpoint, response) self.endpoint = endpoint