Module: ScoutApm::Error

Defined in:
lib/scout_apm/error.rb

Class Method Summary collapse

Class Method Details

.capture(exception, env = {}) ⇒ Object

Capture an exception, optionally with an environment hash. This may be a Rack environment, but is not required.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/scout_apm/error.rb', line 8

def self.capture(exception, env={})
  context = ScoutApm::Agent.instance.context

  # Skip if error monitoring isn't enabled at all
  if ! context.config.value("errors_enabled")
    return false
  end

  # Skip if this one error is ignored
  if context.ignored_exceptions.ignored?(exception)
    return false
  end

  # Capture the error for further processing and shipping
  context.error_buffer.capture(exception, env)

  return true
end