Class: Faultline::Notifier

Inherits:
Airbrake::Notifier
  • Object
show all
Defined in:
lib/faultline/notifier.rb

Constant Summary collapse

LOG_LABEL =
'**Faultline:'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(user_config) ⇒ Notifier

Returns a new instance of Notifier.



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/faultline/notifier.rb', line 5

def initialize(user_config)
  @config = (user_config.is_a?(Config) ? user_config : Config.new(user_config))

  unless @config.valid?
    raise Airbrake::Error, @config.validation_error_message
  end

  @filter_chain = Airbrake::FilterChain.new
  add_default_filters

  @async_sender = AsyncSender.new(@config)
  @sync_sender = SyncSender.new(@config)
end

Instance Method Details

#build_notice(exception, params = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/faultline/notifier.rb', line 19

def build_notice(exception, params = {})
  if @async_sender.closed?
    raise Airbrake::Error,
          "attempted to build #{exception} with closed Airbrake instance"
  end

  if exception.is_a?(Faultline::Notice)
    exception[:params].merge!(params)
    exception
  else
    Faultline::Notice.new(@config, convert_to_exception(exception), params)
  end
end