Public Instance methods
error_email(exception)
Send an email for the given error. exception is usually an exception instance, but it can be a plain string which is used as the subject for the email.
[show source]
# File lib/roda/plugins/error_email.rb 135 def error_email(exception) 136 email_opts = self.class.error_email_opts.dup 137 email_opts[:message] = error_email_content(exception) 138 email_opts[:emailer].call(email_opts) 139 end
error_email_content(exception)
The content of the email to send, include the headers and the body. Takes the same argument as error_email.
[show source]
# File lib/roda/plugins/error_email.rb 143 def error_email_content(exception) 144 email_opts = self.class.error_email_opts 145 headers = email_opts[:default_headers].call(email_opts, exception) 146 headers = headers.merge(email_opts[:headers]) 147 headers = headers.map{|k,v| "#{k}: #{v.gsub(/\r?\n/m, "\r\n ")}"}.sort.join("\r\n") 148 body = email_opts[:body].call(self, exception) 149 "#{headers}\r\n\r\n#{body}" 150 end