class Restforce::DB::SynchronizationError

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.

Attributes

base_exception[R]

Public Class Methods

new(base_exception, instance) click to toggle source

Public: Initialize a new SynchronizationError.

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

# File lib/restforce/db/synchronization_error.rb, line 24
def initialize(base_exception, instance)
  @base_exception = base_exception
  @instance = instance
end

Public Instance Methods

message() click to toggle source

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

Returns a String.

# 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