module Ketchup::Handler

Public Instance Methods

action(*args) click to toggle source
# File lib/util/handler.rb, line 7
def action(*args)
  options = args.extract_options!
  handler = args.first
  self.send(handler, options)
end

Private Instance Methods

database(args) click to toggle source
# File lib/util/handler.rb, line 21
def database(args)
  error = args[:exception]
  attributes = {
    :kind => error.class.name,
    :message => error.message,
    :happend_at => Time.now
  }
  if error.respond_to?(:backtrace)
    attributes.merge!(:backtrace => error.backtrace)
  end
  Ketchup::Exception::Error.create(attributes)
end
mail(args={}) click to toggle source
# File lib/util/handler.rb, line 15
def mail(args={})
  error = args[:exception]
  host = args[:host]
  Ketchup::Exception::Mailer.notification_email(error,host).deliver   
end