Welcome to mirror list, hosted at ThFree Co, Russian Federation.

error.rb « error_tracking « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 012dcc4418ffa07efd09d95dc8e40d4adb7578f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

class ErrorTracking::Error < ApplicationRecord
  belongs_to :project

  has_many :events, class_name: 'ErrorTracking::ErrorEvent'

  validates :project, presence: true
  validates :name, presence: true
  validates :description, presence: true
  validates :actor, presence: true

  def self.report_error(name:, description:, actor:, platform:, timestamp:)
    safe_find_or_create_by(
      name: name,
      description: description,
      actor: actor,
      platform: platform
    ) do |error|
      error.update!(last_seen_at: timestamp)
    end
  end
end