exception_handling 2.4.2 → 2.4.3.pre.1
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 +4 -4
- data/.gitignore +1 -0
- data/Appraisals +3 -3
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/gemfiles/rails_5.gemfile +3 -3
- data/lib/exception_handling/version.rb +1 -1
- data/lib/exception_handling.rb +8 -1
- data/test/test_helper.rb +5 -2
- data/test/unit/exception_handling_test.rb +28 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5acc3546b0ac3da2bcfbdc00e013fafa3d4fa552dc3d899a61e109c9b406b93
|
4
|
+
data.tar.gz: 05ddf01fa324a5951b6af074ade46090db6fe9288a85d137331f33ababf9e8e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2cc8be5a481a2ef381f710f5c566415635e2cbe8964a5d15ef0612aea72a4a62e7dde5a571b354025c8c0ca98076c323cedaab96ab54cff2e9359700b487dc4
|
7
|
+
data.tar.gz: 259376e8b5a1053203f5aeb358b765a7b61b56bd817e1a664e2b98ea2ca783d7f46997056ec4508007f36e002122e83f4d992a3b27d29984d852ae9c1a698922
|
data/.gitignore
CHANGED
data/Appraisals
CHANGED
@@ -7,9 +7,9 @@ appraise "rails-4" do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
appraise "rails-5" do
|
10
|
-
gem 'actionmailer', '~> 5.
|
11
|
-
gem 'actionpack', '~> 5.
|
12
|
-
gem 'activesupport', '~> 5.
|
10
|
+
gem 'actionmailer', '~> 5.2'
|
11
|
+
gem 'actionpack', '~> 5.2'
|
12
|
+
gem 'activesupport', '~> 5.2'
|
13
13
|
end
|
14
14
|
|
15
15
|
appraise "rails-6" do
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,13 @@ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
5
5
|
Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [2.4.3] - Unreleased
|
8
|
+
### Deprecated
|
9
|
+
- In `ExceptionHandling.logger=`, implicit `logger.extend ContextualLogger::LoggerMixin` is now deprecated.
|
10
|
+
This will be removed in version 3.0 and an `ArgumentError` will be raised if the logger
|
11
|
+
doesn't have that mixin. Instead of this implicit behavior, you should explicitly either `extend`
|
12
|
+
your logger instance or `include` that mixin into your `Logger` class.
|
13
|
+
|
7
14
|
## [2.4.2] - 2020-05-11
|
8
15
|
### Added
|
9
16
|
- Added support for rails 5 and 6.
|
@@ -17,5 +24,6 @@ Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0
|
|
17
24
|
### Changed
|
18
25
|
- No longer depends on hobo_support. Uses invoca-utils 0.3 instead.
|
19
26
|
|
27
|
+
[2.4.3]: https://github.com/Invoca/exception_handling/compare/v2.4.2...v2.4.3
|
20
28
|
[2.4.2]: https://github.com/Invoca/exception_handling/compare/v2.4.1...v2.4.2
|
21
29
|
[2.4.1]: https://github.com/Invoca/exception_handling/compare/v2.4.0...v2.4.1
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/gemfiles/rails_5.gemfile
CHANGED
@@ -11,8 +11,8 @@ gem "rake"
|
|
11
11
|
gem "rr"
|
12
12
|
gem "rubocop"
|
13
13
|
gem "shoulda"
|
14
|
-
gem "actionmailer", "~> 5.
|
15
|
-
gem "actionpack", "~> 5.
|
16
|
-
gem "activesupport", "~> 5.
|
14
|
+
gem "actionmailer", "~> 5.2"
|
15
|
+
gem "actionpack", "~> 5.2"
|
16
|
+
gem "activesupport", "~> 5.2"
|
17
17
|
|
18
18
|
gemspec path: "../"
|
data/lib/exception_handling.rb
CHANGED
@@ -54,8 +54,15 @@ module ExceptionHandling # never included
|
|
54
54
|
@logger or raise ArgumentError, "You must assign a value to #{name}.logger"
|
55
55
|
end
|
56
56
|
|
57
|
+
Deprecation3_0 = ActiveSupport::Deprecation.new('3.0', 'exception_handling')
|
58
|
+
|
57
59
|
def logger=(logger)
|
58
|
-
@logger = logger.is_a?(ContextualLogger)
|
60
|
+
@logger = if logger.is_a?(ContextualLogger::LoggerMixin)
|
61
|
+
logger
|
62
|
+
else
|
63
|
+
Deprecation3_0.deprecation_warning('implicit extend with ContextualLogger::LoggerMixin', 'extend your logger instance or include your into your logger class first')
|
64
|
+
logger.extend(ContextualLogger::LoggerMixin)
|
65
|
+
end
|
59
66
|
end
|
60
67
|
|
61
68
|
def default_metric_name(exception_data, exception, treat_like_warning)
|
data/test/test_helper.rb
CHANGED
@@ -23,10 +23,13 @@ require 'exception_handling/testing'
|
|
23
23
|
ActiveSupport::TestCase.test_order = :sorted
|
24
24
|
|
25
25
|
class LoggerStub
|
26
|
-
include ContextualLogger
|
27
|
-
attr_accessor :logged
|
26
|
+
include ContextualLogger::LoggerMixin
|
27
|
+
attr_accessor :logged, :level
|
28
28
|
|
29
29
|
def initialize
|
30
|
+
@level = Logger::Severity::DEBUG
|
31
|
+
@progname = nil
|
32
|
+
@logdev = nil
|
30
33
|
clear
|
31
34
|
end
|
32
35
|
|
@@ -8,6 +8,10 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
|
|
8
8
|
include ControllerHelpers
|
9
9
|
include ExceptionHelpers
|
10
10
|
|
11
|
+
setup do
|
12
|
+
@fail_count = 0
|
13
|
+
end
|
14
|
+
|
11
15
|
def dont_stub_log_error
|
12
16
|
true
|
13
17
|
end
|
@@ -109,6 +113,30 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
|
|
109
113
|
stub(Honeybadger).notify(anything)
|
110
114
|
end
|
111
115
|
|
116
|
+
context "with logger stashed" do
|
117
|
+
setup { @original_logger = ExceptionHandling.logger }
|
118
|
+
teardown { ExceptionHandling.logger = @original_logger }
|
119
|
+
|
120
|
+
should "store logger as-is if it has ContextualLogger::Mixin" do
|
121
|
+
logger = Logger.new('/dev/null')
|
122
|
+
logger.extend(ContextualLogger::LoggerMixin)
|
123
|
+
ancestors = logger.singleton_class.ancestors.*.name
|
124
|
+
|
125
|
+
ExceptionHandling.logger = logger
|
126
|
+
assert_equal ancestors, ExceptionHandling.logger.singleton_class.ancestors.*.name
|
127
|
+
end
|
128
|
+
|
129
|
+
should "[deprecated] mix in ContextualLogger::Mixin if not there" do
|
130
|
+
mock(STDERR).puts(/DEPRECATION WARNING: implicit extend with ContextualLogger::LoggerMixin is deprecated and will be removed from exception_handling 3\.0/)
|
131
|
+
logger = Logger.new('/dev/null')
|
132
|
+
ancestors = logger.singleton_class.ancestors.*.name
|
133
|
+
|
134
|
+
ExceptionHandling.logger = logger
|
135
|
+
assert_not_equal ancestors, ExceptionHandling.logger.singleton_class.ancestors.*.name
|
136
|
+
assert_kind_of ContextualLogger::LoggerMixin, ExceptionHandling.logger
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
112
140
|
context "#log_error" do
|
113
141
|
should "take in additional logging context hash and pass it to the logger" do
|
114
142
|
ExceptionHandling.log_error('This is an Error', 'This is the prefix context', service_name: 'exception_handling')
|
@@ -168,7 +196,6 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
|
|
168
196
|
end
|
169
197
|
|
170
198
|
should "support a log_error hook, and pass exception_data, treat_like_warning, and logged_to_honeybadger to it" do
|
171
|
-
@fail_count = 0
|
172
199
|
@honeybadger_status = nil
|
173
200
|
ExceptionHandling.post_log_error_hook = method(:log_error_callback_config)
|
174
201
|
|
@@ -185,7 +212,6 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
|
|
185
212
|
end
|
186
213
|
|
187
214
|
should "plumb treat_like_warning and logged_to_honeybadger to log error hook" do
|
188
|
-
@fail_count = 0
|
189
215
|
@honeybadger_status = nil
|
190
216
|
ExceptionHandling.post_log_error_hook = method(:log_error_callback_config)
|
191
217
|
ExceptionHandling.log_error(StandardError.new("Some Exception"), "mooo", treat_like_warning: true)
|
@@ -658,7 +684,6 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
|
|
658
684
|
end
|
659
685
|
|
660
686
|
should "not send notification to honeybadger when exception description has the flag turned off and call log error callback with logged_to_honeybadger set to nil" do
|
661
|
-
@fail_count = 0
|
662
687
|
@honeybadger_status = nil
|
663
688
|
ExceptionHandling.post_log_error_hook = method(:log_error_callback_config)
|
664
689
|
filter_list = {
|
@@ -677,7 +702,6 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
|
|
677
702
|
end
|
678
703
|
|
679
704
|
should "call log error callback with logged_to_honeybadger set to false if an error occurs while attempting to notify honeybadger" do
|
680
|
-
@fail_count = 0
|
681
705
|
@honeybadger_status = nil
|
682
706
|
ExceptionHandling.post_log_error_hook = method(:log_error_callback_config)
|
683
707
|
mock(Honeybadger).notify.with_any_args { raise "Honeybadger Notification Failure" }
|
@@ -686,7 +710,6 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
|
|
686
710
|
end
|
687
711
|
|
688
712
|
should "call log error callback with logged_to_honeybadger set to false on unsuccessful honeybadger notification" do
|
689
|
-
@fail_count = 0
|
690
713
|
@honeybadger_status = nil
|
691
714
|
ExceptionHandling.post_log_error_hook = method(:log_error_callback_config)
|
692
715
|
mock(Honeybadger).notify.with_any_args { false }
|
@@ -695,7 +718,6 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
|
|
695
718
|
end
|
696
719
|
|
697
720
|
should "call log error callback with logged_to_honeybadger set to true on successful honeybadger notification" do
|
698
|
-
@fail_count = 0
|
699
721
|
@honeybadger_status = nil
|
700
722
|
ExceptionHandling.post_log_error_hook = method(:log_error_callback_config)
|
701
723
|
mock(Honeybadger).notify.with_any_args { '06220c5a-b471-41e5-baeb-de247da45a56' }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exception_handling
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.3.pre.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Invoca
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|
@@ -179,9 +179,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
179
179
|
version: '0'
|
180
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
181
|
requirements:
|
182
|
-
- - "
|
182
|
+
- - ">"
|
183
183
|
- !ruby/object:Gem::Version
|
184
|
-
version:
|
184
|
+
version: 1.3.1
|
185
185
|
requirements: []
|
186
186
|
rubygems_version: 3.0.3
|
187
187
|
signing_key:
|