Module: Eussiror::ErrorReporter

Defined in:
lib/eussiror/error_reporter.rb

Constant Summary collapse

MAX_BACKTRACE_LINES =
20
USER_ID_KEY =
IssueFormatting::USER_ID_KEY
USER_LABEL_KEY =
IssueFormatting::USER_LABEL_KEY
SOURCE_TAGS =

Maps Rails.error source strings to short tags for issue titles.

{
  "application" => "error",
  "ActionDispatch::Executor" => "request",
  "ActiveJob" => "job",
  "ActionCable::Connection" => "cable"
}.freeze

Class Method Summary collapse

Class Method Details

.report(exception, context = {}, source: "application") ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/eussiror/error_reporter.rb', line 19

def report(exception, context = {}, source: "application")
  config = Eussiror.configuration

  return unless config.reporting_enabled?
  return if ignored?(exception, config)

  tag = source_tag_for(source)
  if config.async
    Thread.new { process(exception, context, config, tag) }
  else
    process(exception, context, config, tag)
  end
rescue StandardError => e
  warn "[Eussiror] ErrorReporter.report raised an unexpected error: #{e.class}: #{e.message}"
end