Sha256: fc22fce64f0e5ed5478f4d950ff3c545386044e38f5510b468a5e425bf67a9c8
Contents?: true
Size: 958 Bytes
Versions: 1
Compression:
Stored size: 958 Bytes
Contents
module ExceptionAlarm class Mailer < ActionMailer::Base self.mailer_name = 'mailer' self.append_view_path "#{File.dirname(__FILE__)}/views" thread_local_accessor :prefix, default: '[ERROR]' thread_local_accessor :sender, default: 'exception@example.com' thread_local_accessor :recipients def alarm(env, exception) @env = env @exception = exception @kontroller = env['action_controller.instance'] @request = ActionDispatch::Request.new(env) attachments["exception_#{@request.host.gsub(".", "_")}_#{Time.now.to_i}.txt"] = render(:alarm) mail( from: self.class.sender, to: self.class.recipients, subject: "#{self.class.prefix} (#{@exception.class}) #{@exception.message.inspect}", body: "A #{@exception.class} occurred in #{@kontroller.controller_name}##{@kontroller.action_name}:\n" + @exception.backtrace.first.to_s ) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
exception-alarm-1.0.2 | lib/exception_alarm/mailer.rb |