Exception: ActiveItem::InvalidGsiKeyTypeError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/active_item/errors.rb

Overview

Raised when a GSI key attribute has an invalid type. DynamoDB GSI keys must be String, Number (Integer/Float/BigDecimal), or Binary (StringIO).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model_name:, attribute:, index_name:, value:) ⇒ InvalidGsiKeyTypeError

Returns a new instance of InvalidGsiKeyTypeError.



91
92
93
94
95
96
97
98
99
# File 'lib/active_item/errors.rb', line 91

def initialize(model_name:, attribute:, index_name:, value:)
  @model_name = model_name
  @attribute = attribute
  @index_name = index_name
  @value = value
  @value_type = value.class.name
  super("#{model_name}##{attribute} has invalid type #{@value_type} for GSI '#{index_name}'. " \
        'GSI keys must be String, Numeric (Integer/Float/BigDecimal), or Binary (StringIO).')
end

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



89
90
91
# File 'lib/active_item/errors.rb', line 89

def attribute
  @attribute
end

#index_nameObject (readonly)

Returns the value of attribute index_name.



89
90
91
# File 'lib/active_item/errors.rb', line 89

def index_name
  @index_name
end

#model_nameObject (readonly)

Returns the value of attribute model_name.



89
90
91
# File 'lib/active_item/errors.rb', line 89

def model_name
  @model_name
end

#valueObject (readonly)

Returns the value of attribute value.



89
90
91
# File 'lib/active_item/errors.rb', line 89

def value
  @value
end

#value_typeObject (readonly)

Returns the value of attribute value_type.



89
90
91
# File 'lib/active_item/errors.rb', line 89

def value_type
  @value_type
end