Class: ExceptionHunter::ErrorGroup

Inherits:
ApplicationRecord show all
Defined in:
app/models/exception_hunter/error_group.rb

Constant Summary collapse

SIMILARITY_THRESHOLD =
0.75

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find_matching_group(error) ⇒ Object



15
16
17
18
19
# File 'app/models/exception_hunter/error_group.rb', line 15

def self.find_matching_group(error)
  where(error_class_name: error.class_name)
    .most_similar(error.message.to_s)
    .first
end

Instance Method Details

#last_occurrenceObject



21
22
23
# File 'app/models/exception_hunter/error_group.rb', line 21

def last_occurrence
  @last_occurrence ||= grouped_errors.maximum(:occurred_at)
end

#total_occurrencesObject



25
26
27
# File 'app/models/exception_hunter/error_group.rb', line 25

def total_occurrences
  @total_occurrences ||= grouped_errors.count
end