lib/avro/builder/errors.rb in avro-builder-0.5.0 vs lib/avro/builder/errors.rb in avro-builder-0.6.0
- old
+ new
@@ -26,18 +26,28 @@
end
end
class DefinitionNotFoundError < StandardError
def initialize(name)
- super("definition not found for '#{name.to_s}'.#{suggest_namespace(name)}")
+ super("definition not found for '#{name}'.#{suggest_namespace(name)}")
end
private
def suggest_namespace(name)
- unless name.to_s.index('.')
- ' Try specifying the full namespace.'
- end
+ ' Try specifying the full namespace.' unless name.to_s.index('.')
+ end
+ end
+
+ class UnsupportedBlockAttributeError < StandardError
+ def initialize(attribute:, type:, field: nil)
+ target = if field
+ "field '#{field}' of type :#{type}"
+ else
+ "type :#{type}"
+ end
+ super("'#{attribute}' must be set directly using an option on #{target}, "\
+ 'not via a block')
end
end
end
end