Exception: RLP::Error::ObjectSerializationError
- Inherits:
-
SerializationError
- Object
- Exception
- RLPException
- SerializationError
- RLP::Error::ObjectSerializationError
- Defined in:
- lib/rlp/error.rb
Overview
Exception raised if serialization of a Sedes::Serializable object fails.
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
Attributes inherited from SerializationError
Instance Method Summary collapse
-
#initialize(message: nil, obj: nil, sedes: nil, list_exception: nil) ⇒ ObjectSerializationError
constructor
A new instance of ObjectSerializationError.
Constructor Details
#initialize(message: nil, obj: nil, sedes: nil, list_exception: nil) ⇒ ObjectSerializationError
Returns a new instance of ObjectSerializationError.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/rlp/error.rb', line 90 def initialize(message: nil, obj: nil, sedes: nil, list_exception: nil) if .nil? raise ArgumentError, "list_exception and sedes must be present" if list_exception.nil? || sedes.nil? if list_exception.element_exception field = sedes.serializable_fields.keys[list_exception.index] = "Serialization failed because of field #{field} ('#{list_exception.element_exception}')" else field = nil = "Serialization failed because of underlying list ('#{list_exception}')" end else field = nil end super(, obj) @field = field @list_exception = list_exception end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
83 84 85 |
# File 'lib/rlp/error.rb', line 83 def field @field end |