File: resque.rb

package info (click to toggle)
ruby-exception-notification 4.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 808 kB
  • sloc: javascript: 7,680; ruby: 1,130; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 526 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require 'resque/failure/base'

module ExceptionNotification
  class Resque < Resque::Failure::Base

    def self.count
      Stat[:failed]
    end

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

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

  end
end