Class: RailsErrorDashboard::SlackErrorNotificationJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
app/jobs/rails_error_dashboard/slack_error_notification_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(error_log_id, locale = nil) ⇒ Object

Parameters:

  • locale (String, nil) (defaults to: nil)

    resolved at enqueue time. nil for jobs enqueued by a pre-Phase-4 version still draining from the queue.



9
10
11
12
13
14
15
16
17
18
19
# File 'app/jobs/rails_error_dashboard/slack_error_notification_job.rb', line 9

def perform(error_log_id, locale = nil)
  error_log = ErrorLog.find_by(id: error_log_id)
  return unless error_log

  webhook_url = RailsErrorDashboard.configuration.slack_webhook_url
  return unless webhook_url.present?

  send_slack_notification(error_log, webhook_url, job_locale(locale))
rescue => e
  Rails.logger.error("Failed to send Slack notification: #{e.message}")
end