File: resque.rb

package info (click to toggle)
ruby-exception-notification 5.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 364 kB
  • sloc: ruby: 1,350; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 512 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

require "resque/failure/base"

module ExceptionNotification
  class Resque < Resque::Failure::Base
    def self.count
      ::Resque::Stat[:failed]
    end

    def save
      data = {
        error_class: exception.class.name,
        error_message: exception.message,
        failed_at: Time.now.to_s,
        payload: payload,
        queue: queue,
        worker: worker.to_s
      }

      ExceptionNotifier.notify_exception(exception, data: {resque: data})
    end
  end
end