Exception: Restforce::DB::SynchronizationError

Inherits:
RuntimeError
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/restforce/db/synchronization_error.rb

Overview

Restforce::DB::SynchronizationError is a thin wrapper for any sort of exception that might crop up during our record synchronization. It exposes the Salesforce ID (or database identifier, for unsynced records) of the record which triggered the exception.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_exception, instance) ⇒ SynchronizationError

Public: Initialize a new SynchronizationError.

base_exception - An exception which should be logged. instance - A Restforce::DB::Instances::Base representing a record.



24
25
26
27
# File 'lib/restforce/db/synchronization_error.rb', line 24

def initialize(base_exception, instance)
  @base_exception = base_exception
  @instance = instance
end

Instance Attribute Details

#base_exceptionObject (readonly)

Returns the value of attribute base_exception.



11
12
13
# File 'lib/restforce/db/synchronization_error.rb', line 11

def base_exception
  @base_exception
end

Instance Method Details

#messageObject

Public: Get the message for this exception. Prepends the Salesforce ID.

Returns a String.



32
33
34
35
36
37
38
39
40
# File 'lib/restforce/db/synchronization_error.rb', line 32

def message
  debug_info = [
    @instance.mapping.database_model,
    @instance.mapping.salesforce_model,
    @instance.id,
  ]

  "[#{debug_info.join('|')}] #{base_exception.message}"
end