Class: RailsErrorDashboard::SwallowedException

Inherits:
ErrorLogsRecord
  • Object
show all
Defined in:
app/models/rails_error_dashboard/swallowed_exception.rb

Overview

Stores aggregated counts of raised-then-rescued exceptions per hourly bucket.

Swallowed exceptions are raised but silently rescued, never reaching the error dashboard. This table tracks raise/rescue counts keyed by exception class, raise location, rescue location, and hourly period.

A high rescue_count/raise_count ratio indicates exceptions being swallowed.

Instance Method Summary collapse

Instance Method Details

#rescue_ratioObject

Rescue ratio: fraction of raises that were rescued (0.0 to 1.0)



27
28
29
30
# File 'app/models/rails_error_dashboard/swallowed_exception.rb', line 27

def rescue_ratio
  return 0.0 if raise_count.zero?
  rescue_count.to_f / raise_count
end

#swallowed?(threshold: nil) ⇒ Boolean

Whether this exception is considered “swallowed” (rescue ratio >= threshold)

Returns:

  • (Boolean)


33
34
35
36
# File 'app/models/rails_error_dashboard/swallowed_exception.rb', line 33

def swallowed?(threshold: nil)
  threshold ||= RailsErrorDashboard.configuration.swallowed_exception_threshold
  rescue_ratio >= threshold
end