class Faultline::Notice

Constants

CONTEXT
NOTIFIER

Public Class Methods

new(config, exception, params = {}) click to toggle source
# File lib/faultline/notice.rb, line 15
def initialize(config, exception, params = {})
  @config = config

  @payload = {
    errors: Airbrake::NestedException.new(exception, @config.logger).as_json,
    context: context,
    environment: {},
    session: {},
    params: params,
    notifications: @config.notifications
  }
  @stash = {}
  @truncator = Airbrake::Truncator.new(PAYLOAD_MAX_SIZE)

  extract_custom_attributes(exception)
end

Public Instance Methods

context() click to toggle source
# File lib/faultline/notice.rb, line 32
def context
  {
    version: @config.app_version,
    # We ensure that root_directory is always a String, so it can always be
    # converted to JSON in a predictable manner (when it's a Pathname and in
    # Rails environment, it converts to unexpected JSON).
    rootDirectory: @config.root_directory.to_s,
    environment: @config.environment,

    # Make sure we always send hostname.
    hostname: HOSTNAME
  }.merge(CONTEXT).delete_if { |_key, val| val.nil? || val.empty? }
end