Class: Faultline::Notice
- Inherits:
-
Airbrake::Notice
- Object
- Airbrake::Notice
- Faultline::Notice
- Defined in:
- lib/faultline/notice.rb
Constant Summary collapse
- NOTIFIER =
{ name: 'faultline-ruby'.freeze, version: Faultline::VERSION, url: 'https://github.com/faultline/faultline-ruby'.freeze }.freeze
- CONTEXT =
{ os: RUBY_PLATFORM, language: "#{RUBY_ENGINE}/#{RUBY_VERSION}".freeze, notifier: NOTIFIER }.freeze
Instance Method Summary collapse
- #context ⇒ Object
-
#initialize(config, exception, params = {}) ⇒ Notice
constructor
A new instance of Notice.
Constructor Details
#initialize(config, exception, params = {}) ⇒ Notice
Returns a new instance of Notice.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# 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 |
Instance Method Details
#context ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# 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 |