Module: Serega::SeregaUtils::SerializedAttributeError

Defined in:
lib/serega/utils/serialized_attribute_error.rb

Overview

Reraises an error, adding which attribute and serializer were being serialized when it happened. Shared by the synchronous serialization walk and the batch attach phase so the message stays identical for every attribute, whether its value is resolved inline or during batch loading.

Class Method Summary collapse

Class Method Details

.call(error, point) ⇒ void

This method returns an undefined value.

Parameters:

  • error (Exception)

    Original error

  • point (SeregaPlanPoint)

    Plan point being serialized



20
21
22
23
24
25
# File 'lib/serega/utils/serialized_attribute_error.rb', line 20

def call(error, point)
  raise error.exception(<<~MESSAGE.strip)
    #{error.message}
    (when serializing '#{point.name}' attribute in #{point.class.serializer_class})
  MESSAGE
end