Class: ErrorappNotifier::Notify

Inherits:
Object
  • Object
show all
Defined in:
lib/errorapp_notifier/notify.rb

Class Method Summary collapse

Class Method Details

.ignore?(exception, request) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/errorapp_notifier/notify.rb', line 24

def ignore?(exception, request)
  ignore_class?(exception) || ignore_user_agent?(request)
end

.ignore_class?(exception) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
31
32
# File 'lib/errorapp_notifier/notify.rb', line 28

def ignore_class?(exception)
  config.ignore_exceptions.flatten.any? do |exception_class|
    exception_class === exception.class.to_s
  end
end

.ignore_user_agent?(request) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
37
38
# File 'lib/errorapp_notifier/notify.rb', line 34

def ignore_user_agent?(request)
  config.ignore_user_agents.flatten.any? do |user_agent|
    user_agent === request.user_agent.to_s
  end
end

.notify(exception, name = nil) ⇒ Object



18
19
20
21
22
# File 'lib/errorapp_notifier/notify.rb', line 18

def notify(exception, name = nil)
  notify_exception(exception) do
    FailureData.new(exception, name)
  end
end

.notify_with_controller(exception, controller = nil, request = nil) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/errorapp_notifier/notify.rb', line 4

def notify_with_controller(exception, controller = nil, request = nil)
  notify_exception(exception) do
    if !ignore?(exception, request)
      ControllerFailureData.new(exception, controller, request)
    end
  end
end

.notify_with_rack(exception, environment, request) ⇒ Object



12
13
14
15
16
# File 'lib/errorapp_notifier/notify.rb', line 12

def notify_with_rack(exception, environment, request)
  notify_exception(exception) do
    RackFailureData.new(exception, environment, request)
  end
end