Class: Lipsiadmin::Mailer::ExceptionNotifier

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
lib/mailer/exception_notifier.rb

Overview

This class send notification through mail if an exception occour in a controller.

Constant Summary collapse

@@sender_address =
%("Exception Notifier" <[email protected]>)
@@recipients_addresses =
[]
@@extra_options =
{}
@@send_mail =
true
@@email_prefix =
"[ERROR] "

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.reloadable?Boolean

:nodoc:

Returns:

  • (Boolean)


25
26
27
# File 'lib/mailer/exception_notifier.rb', line 25

def self.reloadable?#:nodoc:
  false 
end

Instance Method Details

#exception(exception, controller, request) ⇒ Object

This method deliver the exception for the given controller and request



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/mailer/exception_notifier.rb', line 30

def exception(exception, controller, request)
  content_type "text/plain"

  subject    "#{email_prefix} A #{exception.class} occurred in #{controller.controller_name}##{controller.action_name}"

  recipients recipients_addresses
  from       sender_address

  body       :controller => controller, :request => request,
             :exception => exception, :host => (request.env["HTTP_X_FORWARDED_HOST"] || request.env["HTTP_HOST"]),
             :backtrace => exception.backtrace, :extra_options => extra_options
end