Sha256: 0373e84bd76305812fd59b183dffb59ee485c5c613c1028992f3521d121ffc68
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
module Avro module Builder class RequiredAttributeError < StandardError def initialize(type:, attribute:, field: nil, name: nil) location = if field "field '#{field}' of " elsif name "'#{name}' of " end super("attribute :#{attribute} missing for #{location}type :#{type}") end end class DuplicateDefinitionError < StandardError def initialize(key, object, existing_object) super("definition for #{key.inspect} already exists\n"\ "existing definition:\n#{to_json(existing_object)}\n"\ "new definition:\n#{to_json(object)})") end private def to_json(object) object.to_h(SchemaSerializerReferenceState.new).to_json end end class DefinitionNotFoundError < StandardError def initialize(name) super("definition not found for '#{name}'.#{suggest_namespace(name)}") end private def suggest_namespace(name) ' Try specifying the full namespace.' unless name.to_s.index('.') end end AttributeError = Class.new(StandardError) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
avro-builder-0.7.0 | lib/avro/builder/errors.rb |