Exception: LedgerSync::ResourceError::AttributeTypeError

Inherits:
LedgerSync::ResourceError show all
Defined in:
lib/ledger_sync/error/resource_errors.rb

Instance Attribute Summary collapse

Attributes inherited from Error

#message

Instance Method Summary collapse

Constructor Details

#initialize(attribute:, resource:, value:) ⇒ AttributeTypeError

Returns a new instance of AttributeTypeError.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ledger_sync/error/resource_errors.rb', line 12

def initialize(attribute:, resource:, value:)
  @attribute = attribute
  @resource = resource
  @value = value

  resource_class = resource.class

  message = attribute.type.error_message(
    attribute: attribute,
    resource: resource,
    value: value
  )

  super(message: message, resource: nil)
end

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



10
11
12
# File 'lib/ledger_sync/error/resource_errors.rb', line 10

def attribute
  @attribute
end

#resourceObject (readonly)

Returns the value of attribute resource.



10
11
12
# File 'lib/ledger_sync/error/resource_errors.rb', line 10

def resource
  @resource
end

#valueObject (readonly)

Returns the value of attribute value.



10
11
12
# File 'lib/ledger_sync/error/resource_errors.rb', line 10

def value
  @value
end