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

Methods inherited from ApplicationRecord

sql_similarity

Class Method Details

.find_matching_group(error) ⇒ Object



30
31
32
33
34
# File 'app/models/exception_hunter/error_group.rb', line 30

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

Instance Method Details

#first_occurrenceObject



36
37
38
# File 'app/models/exception_hunter/error_group.rb', line 36

def first_occurrence
  @first_occurrence ||= grouped_errors.minimum(:occurred_at)
end

#last_occurrenceObject



40
41
42
# File 'app/models/exception_hunter/error_group.rb', line 40

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

#total_occurrencesObject



44
45
46
# File 'app/models/exception_hunter/error_group.rb', line 44

def total_occurrences
  @total_occurrences ||= grouped_errors.count
end