Class: NewRelic::NoticedError

Inherits:
Object
  • Object
show all
Extended by:
CollectionHelper
Defined in:
lib/new_relic/noticed_error.rb

Overview

This class encapsulates an error that was noticed by RPM in a managed app.

Constant Summary

Constants included from CollectionHelper

CollectionHelper::DEFAULT_ARRAY_TRUNCATION_SIZE, CollectionHelper::DEFAULT_TRUNCATION_SIZE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CollectionHelper

normalize_params, strip_nr_from_backtrace

Constructor Details

#initialize(path, data, exception, timestamp = Time.now) ⇒ NoticedError

Returns a new instance of NoticedError.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/new_relic/noticed_error.rb', line 6

def initialize(path, data, exception, timestamp = Time.now)
  self.path = path
  self.params = NewRelic::NoticedError.normalize_params(data)

  self.exception_class = exception.is_a?(Exception) ? exception.class.name : 'Error'

  if exception.respond_to?('original_exception')
    self.message = exception.original_exception.message.to_s
  else
    self.message = (exception || '<no message>').to_s
  end

  # clamp long messages to 4k so that we don't send a lot of
  # overhead across the wire
  self.message = self.message[0..4095] if self.message.length > 4096

  self.timestamp = timestamp
end

Instance Attribute Details

#exception_classObject

Returns the value of attribute exception_class.



4
5
6
# File 'lib/new_relic/noticed_error.rb', line 4

def exception_class
  @exception_class
end

#messageObject

Returns the value of attribute message.



4
5
6
# File 'lib/new_relic/noticed_error.rb', line 4

def message
  @message
end

#paramsObject

Returns the value of attribute params.



4
5
6
# File 'lib/new_relic/noticed_error.rb', line 4

def params
  @params
end

#pathObject

Returns the value of attribute path.



4
5
6
# File 'lib/new_relic/noticed_error.rb', line 4

def path
  @path
end

#timestampObject

Returns the value of attribute timestamp.



4
5
6
# File 'lib/new_relic/noticed_error.rb', line 4

def timestamp
  @timestamp
end