Class: Vx::Common::ErrorNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/vx/common/error_notifier.rb

Class Method Summary collapse

Class Method Details

.notify(error) ⇒ Object



9
10
11
12
13
# File 'lib/vx/common/error_notifier.rb', line 9

def notify(error)
  if setup
    ::Airbrake.notify(error)
  end
end

.setupObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/vx/common/error_notifier.rb', line 15

def setup
  @configured ||= begin
    return false unless ENV['AIRBRAKE_API_KEY']

    ::Airbrake.configure do |config|
      config.api_key = ENV['AIRBRAKE_API_KEY']
      config.host    = ENV['AIRBRAKE_HOST']
      config.port    = ENV['AIRBRAKE_PORT'] || 80
      config.secure  = config.port == 443
    end
    true
  end
end