Module: ExceptionNotifier

Defined in:
lib/exception_notification_moderate/exception_notifier.rb

Class Method Summary collapse

Class Method Details

.notify_exception(exception, options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/exception_notification_moderate/exception_notifier.rb', line 8

def notify_exception(exception, options={})
  ex_key = exception_key(exception)
  begin
    val = redis.get(ex_key)
  rescue Redis::CannotConnectError
  end
  if val && val.to_i + 60 > Time.now.to_i
    # Write log and return.
    ExceptionNotificationModerate.logger.info(exception)
    return false
  end

  begin
    redis.set(ex_key, Time.now.to_i)
  rescue Redis::CannotConnectError
  end
  original_notify_exception(exception, options)
end

.original_notify_exceptionObject



6
# File 'lib/exception_notification_moderate/exception_notifier.rb', line 6

alias_method :original_notify_exception, :notify_exception