Exception: ActiveItem::ItemTooLargeError

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

Overview

Raised when a DynamoDB put/update fails because the item exceeds the 400KB size limit — typically due to large embedded collections.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model_name:, table:, original_error: nil) ⇒ ItemTooLargeError

Returns a new instance of ItemTooLargeError.



75
76
77
78
79
80
81
82
83
# File 'lib/active_item/errors.rb', line 75

def initialize(model_name:, table:, original_error: nil)
  @model_name = model_name
  @table = table
  msg = "Item exceeds DynamoDB's 400KB limit when saving #{model_name} to #{table}. " \
        'The embedded collection(s) may have too many records. ' \
        'Consider reducing the number of embedded items or moving them to a separate table.'
  msg += " (Original: #{original_error.message})" if original_error
  super(msg)
end

Instance Attribute Details

#model_nameObject (readonly)

Returns the value of attribute model_name.



73
74
75
# File 'lib/active_item/errors.rb', line 73

def model_name
  @model_name
end

#tableObject (readonly)

Returns the value of attribute table.



73
74
75
# File 'lib/active_item/errors.rb', line 73

def table
  @table
end