Module: ScoutApm::Error
- Defined in:
- lib/scout_apm/error.rb
Defined Under Namespace
Classes: Custom, ScoutDefined
Class Method Summary collapse
Class Method Details
.capture(exception, context = {}, env: {}, name: "ScoutApm::Error::Custom") ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/scout_apm/error.rb', line 12 def capture(exception, context={}, env: {}, name: "ScoutApm::Error::Custom") agent_context = ScoutApm::Agent.instance.context # Skip if error monitoring isn't enabled at all if ! agent_context.config.value("errors_enabled") return false end exception = validate_or_create_exception(exception, name) return false unless exception # Skip if this one error is ignored if agent_context.ignored_exceptions.ignored?(exception) return false end unless env.is_a?(Hash) log_warning("Expected env to be a Hash, got #{env.class}") env = {} end unless context.is_a?(Hash) log_warning("Expected context to be a Hash, got #{context.class}") context = {} end ScoutApm::Context.add(context) # Capture the error for further processing and shipping agent_context.error_buffer.capture(exception, env) return true end |