Exception: Turbocable::SerializationError

Inherits:
Error
  • Object
show all
Defined in:
lib/turbocable/errors.rb

Overview

Raised when the configured codec cannot serialize the given payload. Carries the codec name and payload class for diagnosis.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, codec_name:, payload_class:) ⇒ SerializationError

Returns a new instance of SerializationError.

Parameters:

  • message (String)
  • codec_name (Symbol)
  • payload_class (Class)


32
33
34
35
36
# File 'lib/turbocable/errors.rb', line 32

def initialize(message, codec_name:, payload_class:)
  super(message)
  @codec_name = codec_name
  @payload_class = payload_class
end

Instance Attribute Details

#codec_nameSymbol (readonly)

Returns the codec that failed (e.g. :json).

Returns:

  • (Symbol)

    the codec that failed (e.g. :json)



24
25
26
# File 'lib/turbocable/errors.rb', line 24

def codec_name
  @codec_name
end

#payload_classClass (readonly)

Returns the class of the payload that could not be serialized.

Returns:

  • (Class)

    the class of the payload that could not be serialized



27
28
29
# File 'lib/turbocable/errors.rb', line 27

def payload_class
  @payload_class
end