honeybadger 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2777622bd51f0cf653c5645b57e14934ed27954d
4
- data.tar.gz: 1f1a31d68cb68dc2d5737a94136c09fef0c36a25
3
+ metadata.gz: 7e0e979296b465bccca9fadeecbe5fd8b8987b8c
4
+ data.tar.gz: e730b640fb9d0bd97232872e0c1a4d8ac274e078
5
5
  SHA512:
6
- metadata.gz: a3d20098ca94158c51238d7984230a5ca9ad0e05389cd7eb774e7ca82260699d1ab553b5c33419b3d3f2970ee96a0f9c987e18c3104be844e9b5ee01c9b3521e
7
- data.tar.gz: 0f5435235c2f78ad38cd762ad819f9312e5fb90e95aa0b73927ade9b2d15fdf1d0fcd7a319a99eae4ab4b50c7db33ef01b809d884d93c734b7e939d432d07ab9
6
+ metadata.gz: 9546fa7b52d0d2604163c9dae177ea2c7076770424170f265a4f8c8cd4b114f70dd15c1d6daafef1a244551dc28dc194bb6475f43fab07c9ba3404a00c6fca6a
7
+ data.tar.gz: 47d4b6f6863b7e3f1b9ff6b95667cb0c915a125a569023e69524f49ee323f64b8b023fdc847ad0cecbd5c049b6475f3f61519a4a746f2bcf9c21a99d87d53118
data/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ * Detect ActionDispatch::TestProcess being included globally, fix issue locally,
2
+ warn the user.
3
+
4
+ *Joshua Wood*
5
+
6
+ * Fix a nil logger bug when a config error occurs.
7
+
8
+ *Joshua Wood*
9
+
10
+ * Don't instrument metrics and traces in Rails when features are not available
11
+ on account
12
+
13
+ *Joshua Wood*
14
+
15
+ * Don't send error reports when disabled via configuration
16
+
17
+ *Joshua Wood*
@@ -52,7 +52,7 @@ module Honeybadger
52
52
 
53
53
  def_delegators :@values, :update
54
54
 
55
- attr_reader :logger, :features
55
+ attr_reader :features
56
56
 
57
57
  def get(key)
58
58
  key = key.to_sym
@@ -79,6 +79,10 @@ module Honeybadger
79
79
  !!features[feature.to_sym]
80
80
  end
81
81
 
82
+ def logger
83
+ @logger || Logging::BootLogger.instance
84
+ end
85
+
82
86
  def backend
83
87
  Backend.for((self[:backend] || default_backend).to_sym).new(self)
84
88
  end
@@ -163,6 +163,8 @@ module Honeybadger
163
163
  @local_variables = local_variables_from_exception(exception, config, @sanitizer)
164
164
 
165
165
  @api_key = opts[:api_key] || config[:api_key]
166
+
167
+ monkey_patch_action_dispatch_test_process!
166
168
  end
167
169
 
168
170
  # Internal: Template used to create JSON payload
@@ -476,5 +478,36 @@ module Honeybadger
476
478
 
477
479
  c
478
480
  end
481
+
482
+ # Internal: This is how much Honeybadger cares about Rails developers. :)
483
+ #
484
+ # Some Rails projects include ActionDispatch::TestProcess globally for the
485
+ # use of `fixture_file_upload` in tests. This is a bad practice because it
486
+ # includes other methods -- such as #session -- which override existing
487
+ # methods on *all objects*. This creates the following bug in Notice:
488
+ #
489
+ # When you call #session on any object which had previously defined it
490
+ # (such as OpenStruct), that newly defined method calls #session on
491
+ # @request (defined in `ActionDispatch::TestProcess`), and if @request
492
+ # doesn't exist in that object, it calls #session *again* on `nil`, which
493
+ # also inherited it from Object, resulting in a SystemStackError.
494
+ #
495
+ # This method restores the correct #session method on @request and warns
496
+ # the user of the issue.
497
+ #
498
+ # Returns nothing
499
+ def monkey_patch_action_dispatch_test_process!
500
+ return unless defined?(ActionDispatch::TestProcess) && defined?(self.fixture_file_upload)
501
+
502
+ STDOUT.puts('WARNING: It appears you may be including ActionDispatch::TestProcess globally. Check out https://www.honeybadger.io/s/adtp for more info.')
503
+
504
+ def @request.session
505
+ @table[:session]
506
+ end
507
+
508
+ def self.session
509
+ @request.session
510
+ end
511
+ end
479
512
  end
480
513
  end
@@ -11,18 +11,13 @@ module Honeybadger
11
11
  #
12
12
  # require 'honeybadger/rack/error_notifier'
13
13
  #
14
- # Honeybadger.configure do |config|
15
- # config.api_key = 'my_api_key'
16
- # end
17
- #
18
14
  # app = Rack::Builder.app do
19
15
  # run lambda { |env| raise "Rack down" }
20
16
  # end
21
17
  #
22
18
  # use Honeybadger::Rack::ErrorNotifier
23
- # run app
24
19
  #
25
- # Use a standard Honeybadger.configure call to configure your api key.
20
+ # run app
26
21
  class ErrorNotifier
27
22
  extend Forwardable
28
23
 
@@ -1,4 +1,4 @@
1
1
  module Honeybadger
2
2
  # Public: The current String Honeybadger version.
3
- VERSION = '2.0.1'.freeze
3
+ VERSION = '2.0.2'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honeybadger
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Honeybadger Industries LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-31 00:00:00.000000000 Z
11
+ date: 2015-02-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Make managing application errors a more pleasant experience.
14
14
  email:
@@ -18,6 +18,7 @@ executables:
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
+ - CHANGELOG.md
21
22
  - LICENSE
22
23
  - README.md
23
24
  - bin/honeybadger