Class: InboxSync::Notice::RunSyncError

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

Constant Summary collapse

BODY =
%{
:sync_name

An error happened while running this sync.  The error has
been logged but no mail items from this sync's source are
being sync'd.  The runner will continue to attempt this
sync so mails like this will continue until the problem
is fixed.

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 = {}) ⇒ RunSyncError

Returns a new instance of RunSyncError.



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

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

  super(smtp, config)
end

Instance Method Details

#bodyObject



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

def body
  @body ||= BODY.
    gsub(':sync_name', @sync.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/run_sync_error.rb', line 30

def subject
  super("sync run error (#{@sync.uid})")
end