Module: Roda::RodaPlugins::ErrorEmail::InstanceMethods

Defined in:
lib/roda/plugins/error_email.rb

Instance Method Summary collapse

Instance Method Details

#error_email(e) ⇒ Object

Send an email for the given error.



96
97
98
99
100
101
102
103
104
# File 'lib/roda/plugins/error_email.rb', line 96

def error_email(e)
  email_opts = self.class.opts[:error_email].dup
  headers = email_opts[:default_headers].call(email_opts, e)
  headers = headers.merge(email_opts[:headers])
  headers = headers.map{|k,v| "#{k}: #{v}"}.sort.join("\n")
  body = email_opts[:body].call(self, e)
  email_opts[:message] = "#{headers}\n\n#{body}"
  email_opts[:emailer].call(email_opts)
end