class Errorkit::Config

Attributes

alert_threshold[RW]
errors_class[RW]
errors_controller[RW]
errors_layout[RW]
errors_mailer[RW]
format_errors[RW]
ignore_agents[RW]
ignore_exceptions[RW]
mailer_recipients[RW]
mailer_sender[RW]
max_notifications_per_minute[RW]
max_notifications_per_quarter_hour[RW]

Public Class Methods

new() click to toggle source
# File lib/errorkit/config.rb, line 18
def initialize
  @errors_mailer = Errorkit::ErrorsMailer
  @errors_layout = false
  @ignore_exceptions = []
  @ignore_exceptions << ::ActiveRecord::RecordNotFound if defined? ::ActiveRecord::RecordNotFound
  @ignore_exceptions << ::AbstractController::ActionNotFound if defined? ::AbstractController::ActionNotFound
  @ignore_exceptions << ::ActionController::RoutingError if defined? ::ActionController::RoutingError
  @ignore_agents = %w{Googlebot MSNBot Baiduspider Bing Inktomi Yahoo AskJeeves FastCrawler InfoSeek Lycos YandexBot NewRelicPinger Pingdom}
  @max_notifications_per_minute = 5
  @max_notifications_per_quarter_hour = 10
  @format_errors = true
  @alert_threshold = 0.4
end

Public Instance Methods

config() click to toggle source
# File lib/errorkit/config.rb, line 32
def config
  self
end
ignore_agent?(agent) click to toggle source
# File lib/errorkit/config.rb, line 41
def ignore_agent?(agent)
  return false if @ignore_agents.nil? || @ignore_agents.length == 0
  @ignore_agent_re ||= /(#{@ignore_agents.join('|')})/i
  !!(agent =~ @ignore_agents_re)
end
ignore_exception?(exception) click to toggle source
# File lib/errorkit/config.rb, line 36
def ignore_exception?(exception)
  return false if @ignore_exceptions.nil? || @ignore_exceptions.length == 0
  @ignore_exceptions.include?(exception.class)
end