bugsnag 1.0.10 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,18 +1,23 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- crack (0.1.8)
5
4
  git (1.2.5)
6
- httparty (0.7.8)
7
- crack (= 0.1.8)
5
+ httparty (0.8.3)
6
+ multi_json (~> 1.0)
7
+ multi_xml
8
8
  jeweler (1.6.4)
9
9
  bundler (~> 1.0)
10
10
  git (>= 1.2.5)
11
11
  rake
12
- multi_json (1.1.0)
13
- rake (0.9.2)
14
- rcov (0.9.11)
15
- shoulda (2.11.3)
12
+ multi_json (1.3.2)
13
+ multi_xml (0.4.4)
14
+ rake (0.9.2.2)
15
+ rcov (1.0.0)
16
+ shoulda (3.0.1)
17
+ shoulda-context (~> 1.0.0)
18
+ shoulda-matchers (~> 1.0.0)
19
+ shoulda-context (1.0.0)
20
+ shoulda-matchers (1.0.0)
16
21
 
17
22
  PLATFORMS
18
23
  ruby
@@ -0,0 +1,230 @@
1
+ Official Bugsnag Notifier for Ruby
2
+ ==================================
3
+
4
+ The Bugsnag Notifier for Ruby gives you instant notification of exceptions
5
+ thrown from your **Rails**, **Sinatra**, **Rack** or **plain Ruby** app.
6
+ Any uncaught exceptions will trigger a notification to be sent to your
7
+ Bugsnag project.
8
+
9
+
10
+ What is Bugsnag?
11
+ ----------------
12
+
13
+ [Bugsnag](http://bugsnag.com) captures errors in real-time from your web,
14
+ mobile and desktop applications, helping you to understand and resolve them
15
+ as fast as possible. [Create a free account](http://bugsnag.com).
16
+
17
+
18
+ How to Install (Rails)
19
+ ----------------------
20
+
21
+ 1. Add the `bugsnag` gem to your `Gemfile`
22
+
23
+ ```ruby
24
+ gem "bugsnag"
25
+ ```
26
+
27
+ 2. Install the gem
28
+
29
+ ```shell
30
+ bundle install
31
+ ```
32
+
33
+ 3. Copy the following code to a new file at `config/initializers/bugsnag.rb`
34
+
35
+ ```ruby
36
+ Bugsnag.configure do |config|
37
+ config.api_key = "YOUR_API_KEY_HERE"
38
+ end
39
+ ```
40
+
41
+ How to Install (Sinatra)
42
+ ------------------------
43
+
44
+ ```ruby
45
+ require "bugsnag"
46
+
47
+ Bugsnag.configure do |config|
48
+ config.api_key = "YOUR_API_KEY_HERE"
49
+ end
50
+
51
+ use Bugsnag::Rack
52
+ ```
53
+
54
+
55
+ Send Non-Fatal Exceptions to Bugsnag
56
+ ------------------------------------
57
+
58
+ If you would like to send non-fatal exceptions to Bugsnag, there are two
59
+ ways of doing so. From a rails controller, you can call `notify_bugsnag`:
60
+
61
+ ```ruby
62
+ notify_bugsnag(RuntimeError.new("Something broke"))
63
+ ```
64
+
65
+ You can also send additional meta-data with your exception:
66
+
67
+ ```ruby
68
+ notify_bugsnag(RuntimeError.new("Something broke"), {
69
+ :username => "bob-hoskins",
70
+ :registered_user => true
71
+ })
72
+ ```
73
+
74
+ Anywhere else in your ruby code, you can call `Bugsnag.notify`:
75
+
76
+ ```ruby
77
+ Bugsnag.notify(RuntimeError.new("Something broke"));
78
+ ```
79
+
80
+
81
+ Configuration
82
+ -------------
83
+
84
+ To configure additional Bugsnag settings, use the block syntax and set any
85
+ settings you need on the `config` block variable. For example:
86
+
87
+ ```ruby
88
+ Bugsnag.configure do |config|
89
+ config.api_key = "your-api-key-here"
90
+ config.use_ssl = true
91
+ config.notify_release_stages = ["production", "development"]
92
+ end
93
+ ```
94
+
95
+ ###api_key
96
+
97
+ Your Bugsnag API key (required).
98
+
99
+ ```ruby
100
+ config.api_key = "your-api-key-here"
101
+ ```
102
+
103
+ ###release_stage
104
+
105
+ If you would like to distinguish between errors that happen in different
106
+ stages of the application release process (development, production, etc)
107
+ you can set the `release_stage` that is reported to Bugsnag.
108
+
109
+ ```ruby
110
+ config.release_stage = "development"
111
+ ```
112
+
113
+ In rails apps this value is automatically set from `RAILS_ENV`, and in rack
114
+ apps it is automatically set to `RACK_ENV`. Otherwise the default is
115
+ "production".
116
+
117
+ ###notify_release_stages
118
+
119
+ By default, we will only notify Bugsnag of exceptions that happen when
120
+ your `release_stage` is set to be "production". If you would like to
121
+ change which release stages notify Bugsnag of exceptions you can
122
+ set `notify_release_stages`:
123
+
124
+ ```ruby
125
+ config.notify_release_stages = ["production", "development"]
126
+ ```
127
+
128
+ ###auto_notify
129
+
130
+ By default, we will automatically notify Bugsnag of any fatal exceptions
131
+ in your application. If you want to stop this from happening, you can set
132
+ `auto_notify`:
133
+
134
+ ```ruby
135
+ config.auto_notify = false
136
+ ```
137
+
138
+ ###use_ssl
139
+
140
+ Enforces all communication with bugsnag.com be made via ssl.
141
+
142
+ ```ruby
143
+ config.use_ssl = true
144
+ ```
145
+
146
+ By default, `use_ssl` is set to false.
147
+
148
+ ###project_root
149
+
150
+ We mark stacktrace lines as `inProject` if they come from files inside your
151
+ `project_root`. In rails apps this value is automatically set to `RAILS_ROOT`,
152
+ otherwise you should set it manually:
153
+
154
+ ```ruby
155
+ config.project_root = "/var/www/myproject"
156
+ ```
157
+
158
+ ###app_version
159
+
160
+ If you want to track which versions of your application each exception
161
+ happens in, you can set `app_version`. This is set to `nil` by default.
162
+
163
+ ```ruby
164
+ config.app_version = "2.5.1"
165
+ ```
166
+
167
+ ###params_filters
168
+
169
+ Sets the strings to filter out from the `params` hashes before sending
170
+ them to Bugsnag. Use this if you want to ensure you don't send
171
+ sensitive data such as passwords, and credit card numbers to our
172
+ servers. Any keys which contain these strings will be filtered.
173
+
174
+ ```ruby
175
+ config.params_filters << "credit_card_number"
176
+ ```
177
+
178
+ By default, `params_filters` is set to `["password", "password_confirmation"]`
179
+
180
+ ###ignore_classes
181
+
182
+ Sets for which exception classes we should not send exceptions to bugsnag.com.
183
+
184
+ ```ruby
185
+ config.ignore_classes << "ActiveRecord::StatementInvalid"
186
+ ```
187
+
188
+ By default, `ignore_classes` contains the following classes:
189
+
190
+ ```ruby
191
+ [
192
+ "ActiveRecord::RecordNotFound",
193
+ "ActionController::RoutingError",
194
+ "ActionController::InvalidAuthenticityToken",
195
+ "CGI::Session::CookieStore::TamperedWithCookie",
196
+ "ActionController::UnknownAction",
197
+ "AbstractController::ActionNotFound"
198
+ ]
199
+ ```
200
+
201
+
202
+ Reporting Bugs or Feature Requests
203
+ ----------------------------------
204
+
205
+ Please report any bugs or feature requests on the github issues page for this
206
+ project here:
207
+
208
+ <https://github.com/bugsnag/bugsnag-ruby/issues>
209
+
210
+
211
+ Contributing
212
+ ------------
213
+
214
+ - Check out the latest master to make sure the feature hasn't been
215
+ implemented or the bug hasn't been fixed yet
216
+ - Check out the issue tracker to make sure someone already hasn't requested
217
+ it and/or contributed it
218
+ - Fork the project
219
+ - Start a feature/bugfix branch
220
+ - Commit and push until you are happy with your contribution
221
+ - Thanks!
222
+
223
+
224
+ License
225
+ -------
226
+
227
+ The Bugsnag ruby notifier is released under the
228
+ Apache License, Version 2.0. Read the full license here:
229
+
230
+ <http://www.apache.org/licenses/LICENSE-2.0>
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.10
1
+ 1.1.0
@@ -5,23 +5,23 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "bugsnag"
8
- s.version = "1.0.10"
8
+ s.version = "1.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["James Smith"]
12
- s.date = "2012-02-27"
12
+ s.date = "2012-06-18"
13
13
  s.description = "Ruby notifier for bugsnag.com"
14
14
  s.email = "james@bugsnag.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
- "README.rdoc"
17
+ "README.md"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
21
  "Gemfile",
22
22
  "Gemfile.lock",
23
23
  "LICENSE.txt",
24
- "README.rdoc",
24
+ "README.md",
25
25
  "Rakefile",
26
26
  "VERSION",
27
27
  "bugsnag.gemspec",
@@ -35,8 +35,8 @@ Gem::Specification.new do |s|
35
35
  "lib/bugsnag/rails/action_controller_rescue.rb",
36
36
  "lib/bugsnag/rails/controller_methods.rb",
37
37
  "lib/bugsnag/railtie.rb",
38
- "lib/bugsnag/resque.rb",
39
38
  "lib/bugsnag/version.rb",
39
+ "lib/resque/failure/bugsnag.rb",
40
40
  "rails/init.rb",
41
41
  "test/helper.rb",
42
42
  "test/test_bugsnag.rb"
@@ -7,7 +7,8 @@ require "bugsnag/helpers"
7
7
 
8
8
  require "bugsnag/rack"
9
9
  require "bugsnag/railtie" if defined?(Rails::Railtie)
10
- require "bugsnag/resque" if defined?(Resque)
10
+
11
+ require "resque/failure/bugsnag" if defined?(Resque)
11
12
 
12
13
  module Bugsnag
13
14
  LOG_PREFIX = "** [Bugsnag] "
@@ -42,7 +43,7 @@ module Bugsnag
42
43
  # rescuers, unless auto notification is disabled, or we should ignore this
43
44
  # error class
44
45
  def auto_notify(exception, session_data={})
45
- notify_or_ignore(exception, session_data) unless configuration.disable_auto_notification
46
+ notify_or_ignore(exception, session_data) if configuration.auto_notify
46
47
  end
47
48
 
48
49
  # Log wrapper
@@ -1,9 +1,13 @@
1
1
  module Bugsnag
2
2
  class Configuration
3
+ # TODO:JS enforce notify_release_stages
3
4
  OPTIONS = [
4
- :api_key, :release_stage, :use_ssl, :project_root, :app_version,
5
- :framework, :endpoint, :logger, :disable_auto_notification,
6
- :params_filters, :stacktrace_filters, :ignore_classes,
5
+ :api_key, :release_stage, :notify_release_stages, :auto_notify,
6
+ :use_ssl, :project_root, :app_version,
7
+ :params_filters, :ignore_classes,
8
+
9
+ :stacktrace_filters,
10
+ :framework, :endpoint, :logger,
7
11
  :delay_with_resque
8
12
  ]
9
13
  OPTIONS.each {|o| attr_accessor o }
@@ -43,6 +47,9 @@ module Bugsnag
43
47
  @params_filters = DEFAULT_PARAMS_FILTERS.dup
44
48
  @stacktrace_filters = DEFAULT_STACKTRACE_FILTERS.dup
45
49
  @ignore_classes = DEFAULT_IGNORE_CLASSES.dup
50
+ @auto_notify = true
51
+ @release_stage = "production"
52
+ @notify_release_stages = ["production"]
46
53
  end
47
54
 
48
55
  def to_hash
@@ -9,22 +9,22 @@ module Bugsnag
9
9
  NOTIFIER_VERSION = Bugsnag::VERSION
10
10
  NOTIFIER_URL = "http://www.bugsnag.com"
11
11
 
12
- DEFAULT_ENDPOINT = "api.bugsnag.com/notify"
12
+ DEFAULT_ENDPOINT = "notify.bugsnag.com"
13
13
 
14
14
  # HTTParty settings
15
15
  headers "Content-Type" => "application/json"
16
16
  default_timeout 5
17
17
 
18
18
  # Basic notification attributes
19
- attr_accessor :exception
19
+ attr_accessor :exceptions
20
20
 
21
21
  # Attributes from session
22
22
  attr_accessor :user_id, :context, :meta_data
23
23
 
24
24
  # Attributes from configuration
25
25
  attr_accessor :api_key, :params_filters, :stacktrace_filters,
26
- :ignore_classes, :endpoint, :app_version, :release_stage,
27
- :project_root, :use_ssl
26
+ :ignore_classes, :endpoint, :app_version, :release_stage,
27
+ :notify_release_stages, :project_root, :use_ssl
28
28
 
29
29
 
30
30
  def self.deliver_exception_payload(endpoint, payload_string)
@@ -36,19 +36,31 @@ module Bugsnag
36
36
  end
37
37
 
38
38
  def initialize(exception, opts={})
39
- self.exception = exception
39
+ self.exceptions = []
40
+ ex = exception
41
+ while ex != nil
42
+ self.exceptions << ex
43
+
44
+ if ex.respond_to?(:continued_exception) && ex.continued_exception
45
+ ex = ex.continued_exception
46
+ elsif ex.respond_to?(:original_exception) && ex.original_exception
47
+ ex = ex.original_exception
48
+ else
49
+ ex = nil
50
+ end
51
+ end
52
+
40
53
  opts.reject! {|k,v| v.nil?}.each do |k,v|
41
54
  self.send("#{k}=", v) if self.respond_to?("#{k}=")
42
55
  end
43
56
  end
44
57
 
45
58
  def deliver
46
- # Unless we are using a custom endpoint, use api.bugsnag.com, and work out protocol
47
- unless self.endpoint
48
- self.endpoint = (self.use_ssl ? "https://" : "http://") + DEFAULT_ENDPOINT
49
- end
59
+ return unless self.notify_release_stages.include?(self.release_stage)
60
+
61
+ endpoint = (self.use_ssl ? "https://" : "http://") + (self.endpoint || DEFAULT_ENDPOINT)
50
62
 
51
- Bugsnag.log("Notifying #{self.endpoint} of exception")
63
+ Bugsnag.log("Notifying #{endpoint} of exception")
52
64
 
53
65
  payload = {
54
66
  :apiKey => self.api_key,
@@ -58,16 +70,16 @@ module Bugsnag
58
70
  :appVersion => self.app_version,
59
71
  :releaseStage => self.release_stage,
60
72
  :context => self.context,
61
- :exceptions => [exception_hash],
73
+ :exceptions => exception_list,
62
74
  :metaData => self.meta_data
63
75
  }.reject {|k,v| v.nil? }]
64
76
  }
65
77
 
66
- self.class.deliver_exception_payload(self.endpoint, MultiJson.encode(payload))
78
+ self.class.deliver_exception_payload(endpoint, MultiJson.encode(payload))
67
79
  end
68
80
 
69
81
  def ignore?
70
- self.ignore_classes.include?(error_class(self.exception))
82
+ self.ignore_classes.include?(error_class(self.exceptions.last))
71
83
  end
72
84
 
73
85
 
@@ -84,15 +96,30 @@ module Bugsnag
84
96
  @notifier
85
97
  end
86
98
 
87
- def stacktrace_hash
88
- stacktrace = self.exception.backtrace || caller
89
- stacktrace.map do |trace|
99
+ def exception_list
100
+ self.exceptions.map do |exception|
101
+ {
102
+ :errorClass => error_class(exception),
103
+ :message => exception.message,
104
+ :stacktrace => stacktrace(exception)
105
+ }
106
+ end
107
+ end
108
+
109
+ def error_class(exception)
110
+ # The "Class" check is for some strange exceptions like Timeout::Error
111
+ # which throw the error class instead of an instance
112
+ (exception.is_a? Class) ? exception.name : exception.class.name
113
+ end
114
+
115
+ def stacktrace(exception)
116
+ (exception.backtrace || caller).map do |trace|
90
117
  method = nil
91
118
  file, line_str, method_str = trace.split(":")
92
119
 
93
120
  # Generate the stacktrace line hash
94
121
  trace_hash = {}
95
- trace_hash[:inProject] = true if self.project_root && file.match(/^#{self.project_root}/)
122
+ trace_hash[:inProject] = true if self.project_root && file.match(/^#{self.project_root}/) && !file.match(/vendor\//)
96
123
  trace_hash[:file] = self.stacktrace_filters.inject(file) {|file, proc| proc.call(file) }
97
124
  trace_hash[:lineNumber] = line_str.to_i
98
125
 
@@ -110,19 +137,5 @@ module Bugsnag
110
137
  end
111
138
  end.compact
112
139
  end
113
-
114
- def exception_hash
115
- {
116
- :errorClass => error_class(self.exception),
117
- :message => self.exception.message,
118
- :stacktrace => stacktrace_hash
119
- }
120
- end
121
-
122
- def error_class(exception)
123
- # The "Class" check is for some strange exceptions like Timeout::Error
124
- # which throw the error class instead of an instance
125
- (exception.is_a? Class) ? exception.name : exception.class.name
126
- end
127
140
  end
128
141
  end
@@ -15,10 +15,11 @@ module Bugsnag
15
15
 
16
16
  config.after_initialize do
17
17
  Bugsnag.configure do |config|
18
- config.logger ||= Rails.logger
19
- config.release_stage ||= Rails.env
20
- config.project_root ||= Rails.root
18
+ config.release_stage = Rails.env
19
+ config.project_root = Rails.root
21
20
  config.framework = "Rails: #{::Rails::VERSION::STRING}"
21
+
22
+ config.logger ||= Rails.logger
22
23
  end
23
24
 
24
25
  if defined?(::ActionController::Base)
@@ -0,0 +1,47 @@
1
+ # Resque support
2
+
3
+ # How to use:
4
+ # Resque::Failure::Multiple.classes = [Resque::Failure::Redis, Resque::Failure::Bugsnag]
5
+ # Resque::Failure.backend = Resque::Failure::Multiple
6
+ #
7
+
8
+ begin
9
+ require "bugsnag"
10
+ rescue LoadError
11
+ raise "Can't find 'bugsnag' gem. Please add it to your Gemfile or install it."
12
+ end
13
+
14
+ require "resque/failure/base"
15
+
16
+ module Resque
17
+ module Failure
18
+ class Bugsnag < Base
19
+ def self.configure(&block)
20
+ unless ::Resque::Failure.backend < ::Resque::Failure::Multiple
21
+ original_backend = ::Resque::Failure.backend
22
+ ::Resque::Failure.backend = ::Resque::Failure::Multiple
23
+ ::Resque::Failure.backend.classes ||= []
24
+ ::Resque::Failure.backend.classes << original_backend
25
+ end
26
+
27
+ ::Resque::Failure.backend.classes << self
28
+ ::Bugsnag.configure(&block)
29
+ end
30
+
31
+ def save
32
+ ::Bugsnag.auto_notify(exception, bugsnag_job_data)
33
+ end
34
+
35
+ private
36
+ def bugsnag_job_data
37
+ {
38
+ :user_id => nil, # TODO: How to infer a user id in resque?
39
+ :context => "resque: #{queue}",
40
+ :meta_data => {
41
+ :payload => payload
42
+ }
43
+ }
44
+ end
45
+ end
46
+ end
47
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugsnag
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 10
10
- version: 1.0.10
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - James Smith
@@ -15,9 +15,10 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-27 00:00:00 Z
18
+ date: 2012-06-18 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
+ prerelease: false
21
22
  version_requirements: &id001 !ruby/object:Gem::Requirement
22
23
  none: false
23
24
  requirements:
@@ -29,9 +30,9 @@ dependencies:
29
30
  version: "0"
30
31
  requirement: *id001
31
32
  type: :runtime
32
- prerelease: false
33
33
  name: multi_json
34
34
  - !ruby/object:Gem::Dependency
35
+ prerelease: false
35
36
  version_requirements: &id002 !ruby/object:Gem::Requirement
36
37
  none: false
37
38
  requirements:
@@ -43,9 +44,9 @@ dependencies:
43
44
  version: "0"
44
45
  requirement: *id002
45
46
  type: :runtime
46
- prerelease: false
47
47
  name: httparty
48
48
  - !ruby/object:Gem::Dependency
49
+ prerelease: false
49
50
  version_requirements: &id003 !ruby/object:Gem::Requirement
50
51
  none: false
51
52
  requirements:
@@ -57,9 +58,9 @@ dependencies:
57
58
  version: "0"
58
59
  requirement: *id003
59
60
  type: :development
60
- prerelease: false
61
61
  name: shoulda
62
62
  - !ruby/object:Gem::Dependency
63
+ prerelease: false
63
64
  version_requirements: &id004 !ruby/object:Gem::Requirement
64
65
  none: false
65
66
  requirements:
@@ -73,9 +74,9 @@ dependencies:
73
74
  version: 1.0.0
74
75
  requirement: *id004
75
76
  type: :development
76
- prerelease: false
77
77
  name: bundler
78
78
  - !ruby/object:Gem::Dependency
79
+ prerelease: false
79
80
  version_requirements: &id005 !ruby/object:Gem::Requirement
80
81
  none: false
81
82
  requirements:
@@ -89,9 +90,9 @@ dependencies:
89
90
  version: 1.6.4
90
91
  requirement: *id005
91
92
  type: :development
92
- prerelease: false
93
93
  name: jeweler
94
94
  - !ruby/object:Gem::Dependency
95
+ prerelease: false
95
96
  version_requirements: &id006 !ruby/object:Gem::Requirement
96
97
  none: false
97
98
  requirements:
@@ -103,7 +104,6 @@ dependencies:
103
104
  version: "0"
104
105
  requirement: *id006
105
106
  type: :development
106
- prerelease: false
107
107
  name: rcov
108
108
  description: Ruby notifier for bugsnag.com
109
109
  email: james@bugsnag.com
@@ -113,13 +113,13 @@ extensions: []
113
113
 
114
114
  extra_rdoc_files:
115
115
  - LICENSE.txt
116
- - README.rdoc
116
+ - README.md
117
117
  files:
118
118
  - .document
119
119
  - Gemfile
120
120
  - Gemfile.lock
121
121
  - LICENSE.txt
122
- - README.rdoc
122
+ - README.md
123
123
  - Rakefile
124
124
  - VERSION
125
125
  - bugsnag.gemspec
@@ -133,8 +133,8 @@ files:
133
133
  - lib/bugsnag/rails/action_controller_rescue.rb
134
134
  - lib/bugsnag/rails/controller_methods.rb
135
135
  - lib/bugsnag/railtie.rb
136
- - lib/bugsnag/resque.rb
137
136
  - lib/bugsnag/version.rb
137
+ - lib/resque/failure/bugsnag.rb
138
138
  - rails/init.rb
139
139
  - test/helper.rb
140
140
  - test/test_bugsnag.rb
@@ -1,19 +0,0 @@
1
- = bugsnag
2
-
3
- Description goes here.
4
-
5
- == Contributing to bugsnag
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
- * Fork the project
10
- * Start a feature/bugfix branch
11
- * Commit and push until you are happy with your contribution
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2011 James Smith. See LICENSE.txt for
18
- further details.
19
-
@@ -1,36 +0,0 @@
1
- # Resque support
2
-
3
- # How to use:
4
- # Resque::Failure::Multiple.classes = [Resque::Failure::Redis, Bugsnag::Resque]
5
- # Resque::Failure.backend = Resque::Failure::Multiple
6
- #
7
- module Bugsnag
8
- class Resque < ::Resque::Failure::Base
9
- def self.configure(&block)
10
- unless ::Resque::Failure.backend < ::Resque::Failure::Multiple
11
- original_backend = ::Resque::Failure.backend
12
- ::Resque::Failure.backend = ::Resque::Failure::Multiple
13
- ::Resque::Failure.backend.classes ||= []
14
- ::Resque::Failure.backend.classes << original_backend
15
- end
16
-
17
- ::Resque::Failure.backend.classes << self
18
- ::Bugsnag.configure(&block)
19
- end
20
-
21
- def save
22
- Bugsnag.auto_notify(exception, bugsnag_job_data)
23
- end
24
-
25
- private
26
- def bugsnag_job_data
27
- {
28
- :user_id => nil, # TODO: How to infer a user id in resque?
29
- :context => "resque: #{queue}",
30
- :meta_data => {
31
- :payload => payload
32
- }
33
- }
34
- end
35
- end
36
- end