honeybadger 1.9.5 → 1.10.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/Appraisals +0 -12
  2. data/CHANGELOG.md +19 -5
  3. data/Gemfile.lock +1 -5
  4. data/MIT-LICENSE +6 -5
  5. data/README.md +6 -596
  6. data/Rakefile +5 -5
  7. data/features/rails.feature +37 -12
  8. data/features/step_definitions/rails_steps.rb +20 -0
  9. data/features/support/honeybadger_shim.rb.template +3 -5
  10. data/gemfiles/rack.gemfile +0 -1
  11. data/gemfiles/rack.gemfile.lock +1 -8
  12. data/gemfiles/rails2.3.gemfile +0 -1
  13. data/gemfiles/rails2.3.gemfile.lock +1 -8
  14. data/gemfiles/rails3.0.gemfile +0 -2
  15. data/gemfiles/rails3.0.gemfile.lock +2 -12
  16. data/gemfiles/rails3.1.gemfile +0 -2
  17. data/gemfiles/rails3.1.gemfile.lock +3 -13
  18. data/gemfiles/rails3.2.gemfile +0 -2
  19. data/gemfiles/rails3.2.gemfile.lock +4 -14
  20. data/gemfiles/rails4.gemfile +0 -2
  21. data/gemfiles/rails4.gemfile.lock +4 -14
  22. data/gemfiles/rake.gemfile +0 -1
  23. data/gemfiles/rake.gemfile.lock +1 -8
  24. data/gemfiles/sinatra.gemfile +0 -1
  25. data/gemfiles/sinatra.gemfile.lock +1 -8
  26. data/honeybadger.gemspec +7 -3
  27. data/lib/honeybadger.rb +7 -5
  28. data/lib/honeybadger/configuration.rb +7 -3
  29. data/lib/honeybadger/monitor/sender.rb +4 -6
  30. data/lib/honeybadger/notice.rb +30 -4
  31. data/lib/honeybadger/rails.rb +2 -0
  32. data/lib/honeybadger/rails3_tasks.rb +2 -2
  33. data/lib/honeybadger/railtie.rb +3 -1
  34. data/lib/honeybadger/sender.rb +63 -53
  35. data/lib/honeybadger/templates/feedback_form.html.erb +82 -0
  36. data/lib/honeybadger/user_feedback.rb +42 -0
  37. data/lib/honeybadger/user_informer.rb +26 -0
  38. data/spec/honeybadger/configuration_spec.rb +4 -1
  39. data/spec/honeybadger/logger_spec.rb +25 -2
  40. data/spec/honeybadger/notice_spec.rb +69 -3
  41. data/spec/honeybadger/sender_spec.rb +77 -54
  42. data/spec/honeybadger/user_feedback_spec.rb +55 -0
  43. data/spec/honeybadger/user_informer_spec.rb +30 -0
  44. data/spec/support/helpers.rb +9 -6
  45. metadata +63 -39
  46. checksums.yaml +0 -7
data/Appraisals CHANGED
@@ -2,7 +2,6 @@ appraise 'rails2.3' do
2
2
  gem 'rails', '2.3.14'
3
3
  gem 'rake', '0.9.5'
4
4
  gem 'honeybadger', :path => '../'
5
- gem 'faraday', '~> 0.7.0'
6
5
  gem 'capistrano', '~> 2.0'
7
6
  end
8
7
 
@@ -10,8 +9,6 @@ appraise 'rails3.0' do
10
9
  gem 'rails', '3.0.17'
11
10
  gem 'honeybadger', :path => '../'
12
11
  gem 'better_errors', :require => false
13
- gem 'faraday', '~> 0.7.0'
14
- gem 'rack-mini-profiler', :require => false
15
12
  gem 'capistrano', '~> 2.0'
16
13
  end
17
14
 
@@ -19,8 +16,6 @@ appraise 'rails3.1' do
19
16
  gem 'rails', '3.1.8'
20
17
  gem 'honeybadger', :path => '../'
21
18
  gem 'better_errors', :require => false
22
- gem 'faraday', '~> 0.7.0'
23
- gem 'rack-mini-profiler', :require => false
24
19
  gem 'capistrano', '~> 2.0'
25
20
  end
26
21
 
@@ -28,8 +23,6 @@ appraise 'rails3.2' do
28
23
  gem 'rails', '3.2.12'
29
24
  gem 'honeybadger', :path => '../'
30
25
  gem 'better_errors', :require => false
31
- gem 'faraday', '~> 0.7.0'
32
- gem 'rack-mini-profiler', :require => false
33
26
  gem 'capistrano', '~> 2.0'
34
27
  end
35
28
 
@@ -37,8 +30,6 @@ appraise 'rails4' do
37
30
  gem 'rails', '4.0.1'
38
31
  gem 'honeybadger', :path => '../'
39
32
  gem 'better_errors', :require => false
40
- gem 'faraday', '~> 0.7.0'
41
- gem 'rack-mini-profiler', :require => false
42
33
  gem 'capistrano', '~> 2.0'
43
34
  end
44
35
 
@@ -51,17 +42,14 @@ end
51
42
  appraise 'rake' do
52
43
  gem 'sinatra'
53
44
  gem 'honeybadger', :path => '../'
54
- gem 'faraday', '~> 0.7.0'
55
45
  end
56
46
 
57
47
  appraise 'rack' do
58
48
  gem 'rack'
59
49
  gem 'honeybadger', :path => '../'
60
- gem 'faraday', '~> 0.7.0'
61
50
  end
62
51
 
63
52
  appraise 'sinatra' do
64
53
  gem 'sinatra'
65
54
  gem 'honeybadger', :path => '../'
66
- gem 'faraday', '~> 0.7.0'
67
55
  end
data/CHANGELOG.md CHANGED
@@ -1,12 +1,26 @@
1
- ## Honeybadger 1.9.5 ##
1
+ ## Honeybadger 1.10.0 (unreleased) ##
2
2
 
3
- * Call through middleware stack when disabling better_errors in test
4
- task (fixes incorrect error notification bug).
3
+ * Collect user feedback when an error occurs.
5
4
 
6
5
  *Joshua Wood*
7
6
 
8
- * Fix test rake task/rack-mini-profiler bug where it requires an IP
9
- address to identify users.
7
+ * Remove Faraday dependency (restore net/http code)
8
+
9
+ *Joshua Wood*
10
+
11
+ * Added params filtering by regex
12
+
13
+ *Octavian Neamtu*
14
+
15
+ * Bring back the UserInformer
16
+
17
+ *Joshua Wood*
18
+
19
+ * Allow API key to be overridden by notice.
20
+
21
+ *Joshua Wood*
22
+
23
+ * Filter query strings.
10
24
 
11
25
  *Joshua Wood*
12
26
 
data/Gemfile.lock CHANGED
@@ -1,8 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- honeybadger (1.9.5)
5
- faraday (~> 0.7)
4
+ honeybadger (1.10.0.beta1)
6
5
  json
7
6
 
8
7
  GEM
@@ -34,8 +33,6 @@ GEM
34
33
  gherkin (~> 2.11.0)
35
34
  json (>= 1.4.6)
36
35
  diff-lcs (1.2.4)
37
- faraday (0.8.8)
38
- multipart-post (~> 1.2.0)
39
36
  ffi (1.9.3)
40
37
  ffi (1.9.3-java)
41
38
  formatador (0.2.4)
@@ -66,7 +63,6 @@ GEM
66
63
  rb-kqueue (>= 0.2)
67
64
  lumberjack (1.0.4)
68
65
  method_source (0.8.2)
69
- multipart-post (1.2.0)
70
66
  net-scp (1.0.4)
71
67
  net-ssh (>= 1.99.1)
72
68
  net-sftp (2.0.5)
data/MIT-LICENSE CHANGED
@@ -1,10 +1,12 @@
1
- Copyright (c) 2007 - 2012, Exceptional DBA Airbrake.io
2
1
  Portions Copyright (c) 2012-2013, Honeybadger Industries LLC
3
- Portions Copyright (c) 2009 Brenton Fletcher (http://i.bloople.net i@bloople.net)
4
2
  Portions Copyright (c) 2012 Noah Lorang
3
+ Portions Copyright (c) 2007-2012, Exceptional DBA Airbrake.io
4
+ Portions Copyright (c) 2009 Brenton Fletcher (http://i.bloople.net i@bloople.net)
5
5
 
6
- NOTE: All code contained herein that is copyright Exceptional DBA Airbrake.io was available
7
- under the MIT license (listed below) on or before November 6, 2012.
6
+ The original version of the Honeybadger gem was based on the
7
+ MIT-licensed Airbrake gem. All code contained herein that is
8
+ copyright Exceptional DBA Airbrake.io was available under the
9
+ MIT license (listed below) on or before November 6, 2012.
8
10
 
9
11
  Permission is hereby granted, free of charge, to any person
10
12
  obtaining a copy of this software and associated documentation
@@ -27,4 +29,3 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27
29
  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28
30
  OTHER DEALINGS IN THE SOFTWARE.
29
31
 
30
-
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
- Honeybadger
2
- ===============
1
+ # Honeybadger
3
2
 
4
3
  [![Build Status](https://secure.travis-ci.org/honeybadger-io/honeybadger-ruby.png?branch=master)](http://travis-ci.org/honeybadger-io/honeybadger-ruby)
5
4
  [![Gem Version](https://badge.fury.io/rb/honeybadger.png)](http://badge.fury.io/rb/honeybadger)
@@ -9,588 +8,9 @@ This is the notifier gem for integrating apps with the :zap: [Honeybadger Except
9
8
  When an uncaught exception occurs, Honeybadger will POST the relevant data
10
9
  to the Honeybadger server specified in your environment.
11
10
 
12
- ## Rails Installation
11
+ ## Documentation
13
12
 
14
- Add the Honeybadger gem to your gemfile:
15
-
16
- ```ruby
17
- gem 'honeybadger'
18
- ```
19
-
20
- Then generate the initializer:
21
-
22
- rails generate honeybadger --api-key <Your Api Key>
23
-
24
- If you prefer to manually create the initializer, that's simple enough.
25
- Just put the code below in `config/initializers/honeybadger.rb`
26
-
27
- ```ruby
28
- Honeybadger.configure do |config|
29
- config.api_key = '[your-api-key]'
30
- end
31
- ```
32
-
33
- That's it!
34
-
35
- ### Rails 2.x
36
-
37
- Add the honeybadger gem to your app. In `config/environment.rb`:
38
-
39
- ```ruby
40
- config.gem 'honeybadger'
41
- ```
42
-
43
- or if you are using bundler:
44
-
45
- ```ruby
46
- gem 'honeybadger', :require => 'honeybadger/rails'
47
- ```
48
-
49
- Then from your project's `RAILS_ROOT`, and in your development environment, run:
50
-
51
- rake gems:install
52
- rake gems:unpack GEM=honeybadger
53
-
54
- As always, if you choose not to vendor the honeybadger gem, make sure
55
- every server you deploy to has the gem installed or your application won't start.
56
-
57
- Finally, create an initializer in `config/initializers` and configure your
58
- API key for your project:
59
-
60
- ```ruby
61
- require 'honeybadger/rails'
62
- Honeybadger.configure do |config|
63
- config.api_key = '[your-api-key]'
64
- end
65
- ```
66
-
67
- ## Rack
68
-
69
- In order to use honeybadger in a non-Rails rack app, just load
70
- honeybadger, configure your API key, and use the Honeybadger::Rack
71
- middleware:
72
-
73
- ```ruby
74
- require 'rack'
75
- require 'honeybadger'
76
-
77
- Honeybadger.configure do |config|
78
- config.api_key = 'my_api_key'
79
- end
80
-
81
- app = Rack::Builder.app do
82
- run lambda { |env| raise "Rack down" }
83
- end
84
-
85
- use Honeybadger::Rack
86
- run app
87
- ```
88
-
89
- ## Sinatra
90
-
91
- Using honeybadger in a Sinatra app is just like a Rack app:
92
-
93
- ```ruby
94
- require 'sinatra'
95
- require 'honeybadger'
96
-
97
- Honeybadger.configure do |config|
98
- config.api_key = 'my api key'
99
- end
100
-
101
- use Honeybadger::Rack
102
-
103
- get '/' do
104
- raise "Sinatra has left the building"
105
- end
106
- ```
107
-
108
- ## Additional integrations:
109
-
110
- * [Catch exceptions in Resque jobs](https://github.com/henrik/resque-honeybadger)
111
- * [Sidekiq - Simple, efficient message processing for Ruby](https://github.com/mperham/sidekiq) (supports Honeybadger natively)
112
- * [DelayedJob](https://github.com/honeybadger-io/delayed_job_honeybadger)
113
-
114
- ## Usage
115
-
116
- For the most part, Honeybadger works for itself.
117
-
118
- It intercepts the exception middleware calls, sends notifications and continues the middleware call chain.
119
-
120
- If you want to log arbitrary things which you've rescued yourself from a
121
- controller, you can do something like this:
122
-
123
- ```ruby
124
- # ...
125
- rescue => ex
126
- notify_honeybadger(ex)
127
- flash[:failure] = 'Encryptions could not be rerouted, try again.'
128
- end
129
- # ...
130
- ```
131
-
132
- The `#notify_honeybadger` call will send the notice over to Honeybadger for later
133
- analysis. While in your controllers you use the `notify_honeybadger` method, anywhere
134
- else in your code, use `Honeybadger.notify`. If you do not want [exception filters](#filtering)
135
- to be skipped, use `notify_honeybadger_or_ignore` and `Honeybadger.notify_or_ignore` instead.
136
-
137
-
138
- To perform custom error processing after Honeybadger has been notified, define the
139
- instance method `#rescue_action_in_public_without_honeybadger(exception)` in your
140
- controller.
141
-
142
- You can test that Honeybadger is working in your production environment by using
143
- this rake task (from RAILS_ROOT):
144
-
145
- rake honeybadger:test
146
-
147
- If everything is configured properly, that task will send a notice to Honeybadger
148
- which will be visible immediately.
149
-
150
- ## Ignored environments
151
-
152
- Please note that in development mode, Honeybadger will **not** be
153
- notified of exceptions that occur, except when running the test rake
154
- task. The following environments are ignored by default: *development*,
155
- *test*, and *cucumber*. You can modify which environments are ignored by
156
- setting the `development_environments` option in your Honeybadger
157
- initializer:
158
-
159
- ```ruby
160
- Honeybadger.configure do |config|
161
- # ...
162
- # To add an additional environment to be ignored:
163
- config.development_environments << 'staging'
164
-
165
- # To override the default environments completely:
166
- config.development_environments = ['test', 'cucumber']
167
- end
168
- ```
169
-
170
- If you choose to override the `development_environments` option for
171
- whatever reason, please make sure your test environments are ignored.
172
-
173
- ## Sending custom data
174
-
175
- Honeybadger allows you to send custom data using `Honeybadger.context`.
176
- Here's an example of sending some user-specific information in a Rails
177
- `before_filter` call:
178
-
179
- ```ruby
180
- before_filter do
181
- Honeybadger.context({
182
- :user_id => current_user.id,
183
- :user_email => current_user.email
184
- }) if current_user
185
- end
186
- ```
187
-
188
- Now, whenever an error occurs, Honeybadger will display the affected
189
- user's id and email address, if available.
190
-
191
- Subsequent calls to `context` will merge the existing hash with any new
192
- data, so you can effectively build up context throughout your
193
- request's life cycle. Honeybadger will discard the data when a
194
- request completes, so that the next request will start with a blank
195
- slate.
196
-
197
- ## Custom error grouping
198
-
199
- By default, we group errors by error class, component (aka controller), and the application trace.
200
-
201
- If you want to use your own grouping strategy,
202
- you can, using the `fingerprint` configuration option. When configured,
203
- a custom fingerprint will be sent with each error notification, and
204
- we'll use that for grouping errors instead of the default:
205
-
206
- Honeybadger.configure do |config|
207
- ...
208
-
209
- # See lib/honeybadger/notice.rb for the options that are available
210
- # on the notice object
211
- config.fingerprint do |notice|
212
- [notice[:error_class], notice[:component], notice[:backtrace].to_s].join(':')
213
- end
214
-
215
- end
216
-
217
- You can also pass the fingerprint as a string when notifying Honeybadger
218
- directly:
219
-
220
- Honeybadger.notify(StandardError.new('oh noes!'), :fingerprint => 'asdf')
221
-
222
- The fingerprint can be any Ruby object that responds to #to_s, and will
223
- be sent to Honeybadger as a SHA1 hash.
224
-
225
-
226
- ## Tracking deploys
227
-
228
- Honeybadger has an API to keep track of project deployments. Whenever
229
- you deploy, all errors for that environment will be resolved
230
- automatically. You can choose to enable or disable the auto-resolve
231
- feature from your Honeybadger project settings page.
232
-
233
- We officially support deploy tracking using Capistrano and Heroku:
234
-
235
- ### Capistrano
236
-
237
- In order to track deployments using Capistrano, simply require
238
- Honeybadger's Capistrano task in your `config/deploy.rb` file:
239
-
240
- ```ruby
241
- require 'honeybadger/capistrano'
242
- ```
243
-
244
- If you ran the Honeybadger install generator in a project that was
245
- previously configured with Capistrano, we already added this for you.
246
-
247
- The Capistrano task will run our `rake honeybadger:deploy` task on
248
- the server you are deploying to, so that it can correctly report
249
- environment-related information. To override the task that is run, you
250
- can set the `:honeybadger_deploy_task` in your *config/deploy.rb* file:
251
-
252
- ```ruby
253
- # Loads Rails environment before executing normal deploy task
254
- set :honeybadger_deploy_task, 'honeybadger:deploy_with_environment'
255
- ```
256
-
257
- You can run deploy notification task asynchronously.
258
- Just add `:honeybadger_async_notify` in your *config/deploy.rb* file:
259
-
260
- ```ruby
261
- set :honeybadger_async_notify, true
262
- ````
263
-
264
- If you would prefer to notify Honeybadger locally without using rake,
265
- check out our blog post: [Honeybadger and Capistrano: the metal way](http://honeybadger.io/blog/2012/10/06/honeybadger-and-capistrano/).
266
-
267
-
268
- ### Heroku
269
-
270
- Deploy tracking via Heroku is implemented using Heroku's free [deploy
271
- hooks](https://devcenter.heroku.com/articles/deploy-hooks) addon. To
272
- install the addon and configure it for Honeybadger, run the following
273
- rake task from your project root:
274
-
275
- rake honeybadger:heroku:add_deploy_notification APP=app-name
276
-
277
- Don't forget to replace "app-name" with the name of your app on
278
- Heroku. Or, if you want to add the deploy hook manually, run:
279
-
280
- heroku addons:add deployhooks:http --url="https://api.honeybadger.io/v1/deploys?deploy[environment]=production&api_key=asdf" --app app-name
281
-
282
- You should replace the api key and app-name with your own values. You
283
- may also want to change the environment (set to production by default).
284
-
285
- ### Via Rake
286
-
287
- If you are using other frameworks/platforms, you can still notify us of
288
- a deploy. We provide a rake task that uses ENV variables to report
289
- environment information:
290
-
291
- # Skips loading the Rails environment if Rails and the honeybadger
292
- # initializer are detected
293
- rake honeybadger:deploy TO=production
294
-
295
- # Always loads the Rails environment
296
- rake honeybadger:deploy_with_environment TO=production
297
-
298
- You can optionally add:
299
-
300
- * `REPO=[scm repo url]`
301
- * `REVISION=[scm sha]`
302
- * `USER=[local user's name]`
303
- * `API_KEY=[a different api key]`
304
- * `DRY_RUN=true (simulates notification)`
305
-
306
- ## Notifying Honeybadger asynchronously
307
-
308
- Want to send notices in a thread, or even use Resque or Sidekiq to
309
- deliver notifications? The 'badger has you covered.
310
-
311
- To get started, you'll need to configure Honeybadger to accept a
312
- handler. A handler can be any object that responds to `#call` (usually a
313
- `Proc`) and accepts one argument (a `Honeybadger::Notice` instance). The
314
- handler can be set directly by setting the `async` configuration option,
315
- or by passing a block to `config.async` (in this case, a Proc instance
316
- will be created for you):
317
-
318
- ```ruby
319
- Honeybadger.configure do |config|
320
- # ...
321
-
322
- # Configuring handler directly:
323
- config.async do |notice|
324
- # Delivers notification immediately
325
- notice.deliver # => 'qwer-asdf-zxcv'
326
- end
327
-
328
- # Using your own handler (identical behavior):
329
- config.async = Proc.new { |n| n.deliver }
330
- end
331
- ```
332
-
333
- We've left the implementation mostly up to you, but here are a few
334
- examples of notifying Honeybadger asynchronously:
335
-
336
- ### Using thread
337
-
338
- ```ruby
339
- Honeybadger.configure do |config|
340
- config.async do |notice|
341
- Thread.new { notice.deliver }
342
- end
343
- end
344
- ```
345
-
346
- ### Using Resque
347
-
348
- ```ruby
349
- Honeybadger.configure do |config|
350
- config.async do |notice|
351
- Resque.enqueue(WorkingBadger, notice.to_json)
352
- end
353
- end
354
-
355
- class WorkingBadger
356
- @queue = :cobra_alert
357
-
358
- def self.perform(notice)
359
- Honeybadger.sender.send_to_honeybadger(notice)
360
- end
361
- end
362
- ```
363
-
364
- ### Using Sidekiq
365
-
366
- ```ruby
367
- Honeybadger.configure do |config|
368
- config.async do |notice|
369
- WorkingBadger.perform_async(notice.to_json)
370
- end
371
- end
372
-
373
- class WorkingBadger
374
- include Sidekiq::Worker
375
-
376
- def perform(notice)
377
- Honeybadger.sender.send_to_honeybadger(notice)
378
- end
379
- end
380
- ```
381
-
382
- ### Using GirlFriday
383
-
384
- ```ruby
385
- COBRA_QUEUE = GirlFriday::WorkQueue.new(:honeybadger_notices, :size => 7) do |notice|
386
- notice.deliver
387
- end
388
-
389
- Honeybadger.configure do |config|
390
- config.async do |notice|
391
- COBRA_QUEUE.push(notice)
392
- end
393
- end
394
- ```
395
-
396
- ## Going beyond exceptions
397
-
398
- You can also pass a hash to `Honeybadger.notify` method and store whatever you want,
399
- not just an exception. And you can also use it anywhere, not just in
400
- controllers:
401
-
402
- ```ruby
403
- begin
404
- params = {
405
- # params that you pass to a method that can throw an exception
406
- }
407
- my_unpredicable_method(*params)
408
- rescue => e
409
- Honeybadger.notify(
410
- :error_class => "Special Error",
411
- :error_message => "Special Error: #{e.message}",
412
- :parameters => params
413
- )
414
- end
415
- ```
416
-
417
- While in your controllers you use the `notify_honeybadger` method, anywhere else in
418
- your code, use `Honeybadger.notify`. Honeybadger will get all the information
419
- about the error itself. As for a hash, these are the keys you should pass:
420
-
421
- * `:error_class` - Use this to group similar errors together. When Honeybadger catches an exception it sends the class name of that exception object.
422
- * `:error_message` - This is the title of the error you see in the errors list. For exceptions it is "#{exception.class.name}: #{exception.message}"
423
- * `:parameters` - While there are several ways to send additional data to Honeybadger, passing a Hash as :parameters as in the example above is the most common use case. When Honeybadger catches an exception in a controller, the actual HTTP client request parameters are sent using this key.
424
-
425
- Honeybadger merges the hash you pass with these default options:
426
-
427
- ```ruby
428
- {
429
- :api_key => Honeybadger.api_key,
430
- :error_message => 'Notification',
431
- :backtrace => caller,
432
- :parameters => {},
433
- :session => {},
434
- :context => {}
435
- }
436
- ```
437
-
438
- You can override any of those parameters.
439
-
440
- ### Sending shell environment variables when "Going beyond exceptions"
441
-
442
- One common request we see is to send shell environment variables along with
443
- manual exception notification. We recommend sending them along with CGI data
444
- or Rack environment (:cgi_data or :rack_env keys, respectively.)
445
-
446
- See `Honeybadger::Notice#initialize` in
447
- [lib/honeybadger/notice.rb](https://github.com/honeybadger-io/honeybadger-ruby/blob/master/lib/honeybadger/notice.rb)
448
- for more details.
449
-
450
- ## Filtering
451
-
452
- You can specify a whitelist of errors that Honeybadger will not report on. Use
453
- this feature when you are so apathetic to certain errors that you don't want
454
- them even logged.
455
-
456
- This filter will only be applied to automatic notifications, not manual
457
- notifications (when #notify is called directly).
458
-
459
- Honeybadger ignores the following exceptions by default:
460
-
461
- ```ruby
462
- ActiveRecord::RecordNotFound
463
- ActionController::RoutingError
464
- ActionController::InvalidAuthenticityToken
465
- CGI::Session::CookieStore::TamperedWithCookie
466
- ActionController::UnknownAction
467
- AbstractController::ActionNotFound
468
- Mongoid::Errors::DocumentNotFound
469
- ```
470
-
471
- To ignore errors in addition to those, specify their names in your Honeybadger
472
- configuration block. You may use a string, regexp, or class:
473
-
474
- ```ruby
475
- Honeybadger.configure do |config|
476
- config.api_key = '1234567890abcdef'
477
- config.ignore << /IgnoredError$/
478
- config.ignore << "ActiveRecord::IgnoreThisError"
479
- config.ignore << OtherException
480
- end
481
- ```
482
-
483
- To ignore *only* certain errors (and override the defaults), use the #ignore_only attribute.
484
-
485
- ```ruby
486
- Honeybadger.configure do |config|
487
- config.api_key = '1234567890abcdef'
488
- config.ignore_only = ["ActiveRecord::IgnoreThisError"] # or [] to ignore no exceptions.
489
- end
490
- ```
491
-
492
- Subclasses of ignored classes will also be ignored, while strings and
493
- regexps are compared with the error class name only.
494
-
495
- To ignore certain user agents, add in the #ignore_user_agent attribute as a
496
- string or regexp:
497
-
498
- ```ruby
499
- Honeybadger.configure do |config|
500
- config.api_key = '1234567890abcdef'
501
- config.ignore_user_agent << /Ignored/
502
- config.ignore_user_agent << 'IgnoredUserAgent'
503
- end
504
- ```
505
-
506
- To ignore exceptions based on other conditions, use #ignore_by_filter:
507
-
508
- ```ruby
509
- Honeybadger.configure do |config|
510
- config.api_key = '1234567890abcdef'
511
- config.ignore_by_filter do |exception_data|
512
- true if exception_data[:error_class] == "RuntimeError"
513
- end
514
- end
515
- ```
516
-
517
- To replace sensitive information sent to the Honeybadger service with [FILTERED] use #params_filters:
518
-
519
- ```ruby
520
- Honeybadger.configure do |config|
521
- config.api_key = '1234567890abcdef'
522
- config.params_filters << "credit_card_number"
523
- end
524
- ```
525
-
526
- Note that, when rescuing exceptions within an ActionController method,
527
- honeybadger will reuse filters specified by #filter_parameter_logging.
528
-
529
- To disable sending session data:
530
-
531
- ```ruby
532
- Honeybadger.configure do |config|
533
- config.api_key = '1234567890abcdef'
534
- config.send_request_session = false
535
- end
536
- ```
537
-
538
- ## Setting the hostname
539
-
540
- The hostname for the local server is determined by `Socket.gethostname`
541
- by default, but can be overridden using the `hostname` configuration
542
- option:
543
-
544
- ```ruby
545
- Honeybadger.configure do |config|
546
- # ...
547
- config.hostname = `hostname`
548
- end
549
- ```
550
-
551
- ## Testing
552
-
553
- When you run your tests, you might notice that the Honeybadger service is recording
554
- notices generated using #notify when you don't expect it to. You can
555
- use code like this in your test_helper.rb or spec_helper.rb files to redefine
556
- that method so those errors are not reported while running tests.
557
-
558
- ```ruby
559
- module Honeybadger
560
- def self.notify(exception, opts = {})
561
- # do nothing.
562
- end
563
- end
564
- ```
565
-
566
- ## Proxy Support
567
-
568
- The notifier supports using a proxy, if your server is not able to
569
- directly reach the Honeybadger servers. To configure the proxy settings,
570
- added the following information to your Honeybadger configuration block.
571
-
572
- ```ruby
573
- Honeybadger.configure do |config|
574
- config.proxy_host = 'proxy.host.com'
575
- config.proxy_port = 4038
576
- config.proxy_user = 'foo' # optional
577
- config.proxy_pass = 'bar' # optional
578
- end
579
- ```
580
-
581
- ## Troubleshooting
582
-
583
- By default, Honeybadger is quiet when your log level is set to INFO
584
- (most production environments). If you would like to be notified via
585
- logs when Honeybadger completes a successful notification, set the
586
- `config.debug` option to true:
587
-
588
- ```ruby
589
- Honeybadger.configure do |config|
590
- # ...
591
- config.debug = true
592
- end
593
- ```
13
+ [View the Documentation](http://docs.honeybadger.io/article/50-honeybadger-gem-documentation)
594
14
 
595
15
  ## Supported Ruby versions
596
16
 
@@ -598,7 +18,7 @@ Honeybadger supports Ruby 1.8.7 through 2.0.
598
18
 
599
19
  ## Supported Rails versions
600
20
 
601
- Honeybadger supports Rails 2.3.14 through Rails 4.0.0.beta1.
21
+ Honeybadger supports Rails 2.3.14 through Rails 4.0.1.
602
22
 
603
23
  ## Contributing
604
24
 
@@ -619,16 +39,6 @@ available tasks.
619
39
  The RSpec test suite can be run with `rake`, or
620
40
  `rake appraisal:rails2.3` to include Rails-specific specs.
621
41
 
622
- ## Credits
623
-
624
- Original code based on the [airbrake](http://airbrake.io) gem,
625
- originally by Thoughtbot, Inc.
626
-
627
- Thank you to Thoughtbot and all of the Airbrake contributors!
628
-
629
- The nifty custom data (`Honeybadger.context()`) feature was inspired by Exceptional.
630
-
631
- ## License
42
+ ### License
632
43
 
633
- Honeybadger is Copyright 2013 © Honeybadger Industries LLC. It is free software, and
634
- may be redistributed under the terms specified in the MIT-LICENSE file.
44
+ The Honeybadger gem is MIT licensed. See the [MIT-LICENSE](https://raw.github.com/honeybadger-io/honeybadger-ruby/master/MIT-LICENSE) file in this repository for details.