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 134 def error_email(exception) 135 email_opts = self.class.error_email_opts.dup 136 email_opts[:message] = error_email_content(exception) 137 email_opts[:emailer].call(email_opts) 138 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 142 def error_email_content(exception) 143 email_opts = self.class.error_email_opts 144 headers = email_opts[:default_headers].call(email_opts, exception) 145 headers = headers.merge(email_opts[:headers]) 146 headers = headers.map{|k,v| "#{k}: #{v.gsub(/\r?\n/m, "\r\n ")}"}.sort.join("\r\n") 147 body = email_opts[:body].call(self, exception) 148 "#{headers}\r\n\r\n#{body}" 149 end