Class: InboxSync::Notice::SyncMailItemError

Inherits:
Base
  • Object
show all
Defined in:
lib/inbox-sync/notice/sync_mail_item_error.rb

Constant Summary collapse

BODY =
%{
:sync_name
:mail_item_name

An error happened while syncing this mail item.  The error
has been logged and the mail item has been archived on the
source.  The sync will continue processing new mail items.

Error
=====
  :error_message (:error_name)
  :error_backtrace
}.strip.freeze

Instance Attribute Summary

Attributes inherited from Base

#mail

Instance Method Summary collapse

Methods inherited from Base

#from, #send, #to

Constructor Details

#initialize(smtp, config, data = {}) ⇒ SyncMailItemError

Returns a new instance of SyncMailItemError.



22
23
24
25
26
27
28
# File 'lib/inbox-sync/notice/sync_mail_item_error.rb', line 22

def initialize(smtp, config, data={})
  @error = data[:error]
  @mail_item = data[:mail_item]
  @sync = data[:sync]

  super(smtp, config)
end

Instance Method Details

#bodyObject



34
35
36
37
38
39
40
41
# File 'lib/inbox-sync/notice/sync_mail_item_error.rb', line 34

def body
  @body ||= BODY.
    gsub(':sync_name', @sync.name).
    gsub(':mail_item_name', @mail_item.name).
    gsub(':error_message', @error.message).
    gsub(':error_name', @error.class.name).
    gsub(':error_backtrace', @error.backtrace.join("\n  "))
end

#subjectObject



30
31
32
# File 'lib/inbox-sync/notice/sync_mail_item_error.rb', line 30

def subject
  super("mail item sync error (#{@mail_item.uid}, #{@sync.uid})")
end