Exception: Petra::ValueComparisonError

Inherits:
HandlerException show all
Defined in:
lib/petra/exceptions.rb

Direct Known Subclasses

ReadIntegrityError, WriteClashError

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from HandlerException

#continue!, #reset_transaction!, #retry!, #rollback_transaction!

Methods inherited from ExtendedError

#initialize

Constructor Details

This class inherits a constructor from Petra::ExtendedError

Instance Attribute Details

#attributeObject (readonly)

The affected attribute



85
86
87
# File 'lib/petra/exceptions.rb', line 85

def attribute
  @attribute
end

#external_valueObject (readonly)

The new external attribute value



86
87
88
# File 'lib/petra/exceptions.rb', line 86

def external_value
  @external_value
end

#objectObject (readonly)

The affected proxy



84
85
86
# File 'lib/petra/exceptions.rb', line 84

def object
  @object
end

Instance Method Details

#continuable?Boolean

Returns:

  • (Boolean)


107
108
109
# File 'lib/petra/exceptions.rb', line 107

def continuable?
  !@reset && !@rollback
end

#ignore!(update_value: false) ⇒ Object

Tells the current transaction to ignore further errors of this kind until the attribute value is changed again externally.

Parameters:

  • update_value (Boolean) (defaults to: false)

    If set to true, the read set entry for this attribute is updated with the new external value. This means that the new value will be visible inside of the transaction until it changes again.

    Otherwise, the exception is completely ignored and will have no impact on the values displayed inside the transaction.



100
101
102
103
104
105
# File 'lib/petra/exceptions.rb', line 100

def ignore!(update_value: false)
  Petra.current_transaction.current_section.log_read_integrity_override(object,
                                                                        attribute:      attribute,
                                                                        external_value: external_value,
                                                                        update_value:   update_value)
end