exception_handling 2.4.1 → 2.4.4
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 +2 -0
- data/.jenkins/Jenkinsfile +44 -6
- data/Appraisals +19 -0
- data/CHANGELOG.md +23 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +20 -14
- data/README.md +7 -3
- data/exception_handling.gemspec +6 -6
- data/gemfiles/.bundle/config +2 -0
- data/gemfiles/rails_4.gemfile +18 -0
- data/gemfiles/rails_5.gemfile +18 -0
- data/gemfiles/rails_6.gemfile +18 -0
- data/lib/exception_handling.rb +8 -1
- data/lib/exception_handling/version.rb +1 -1
- data/test/test_helper.rb +8 -3
- data/test/unit/exception_handling/exception_catalog_test.rb +1 -1
- data/test/unit/exception_handling_test.rb +51 -9
- metadata +35 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de262141b33b7c4cb5e68018569d0465144097e36d0b85c268646cb0bfb5eb3f
|
4
|
+
data.tar.gz: cdbd41bfd1df237f6d6c3c1788ac52a0ed75314c5fbf63b3cb549edc21aeb3ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a64db1560f94c6c62ced1d7b5afadd1ece6618ee62e41db250b2384e8193b29ec35e39b9389edb2a1e130b2aebf77b4e7851b8173a705b8a7b620284f62e1b9e
|
7
|
+
data.tar.gz: c2efcf1378cf70651ccd1e2e4f3f0f85ff4fe49714f7547d3b4517a0afb1c657f7a8def9dd4339aa7bd510fc714d53b27cc7120fe109fa12eea2c8bbfe98de6e
|
data/.gitignore
CHANGED
data/.jenkins/Jenkinsfile
CHANGED
@@ -19,6 +19,7 @@ pipeline {
|
|
19
19
|
stage('Setup') {
|
20
20
|
steps {
|
21
21
|
script {
|
22
|
+
updateGitHubStatus('clean-build', 'pending', 'Unit tests.')
|
22
23
|
sh '''
|
23
24
|
# get SSH setup inside the container
|
24
25
|
eval `ssh-agent -s`
|
@@ -27,18 +28,55 @@ pipeline {
|
|
27
28
|
ssh-keyscan -t rsa github.com > /root/.ssh/known_hosts
|
28
29
|
|
29
30
|
bundle install
|
31
|
+
bundle exec appraisal install
|
30
32
|
'''
|
31
33
|
}
|
32
34
|
}
|
33
35
|
}
|
34
|
-
stage('
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
stage('Appraisals') {
|
37
|
+
parallel {
|
38
|
+
stage('Current') {
|
39
|
+
steps {
|
40
|
+
sh 'JUNIT_OUTPUT_DIR=test/reports/current bundle exec rake'
|
41
|
+
}
|
42
|
+
|
43
|
+
post {
|
44
|
+
always { junit '*/reports/current/*.xml' }
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
stage('Rails 4') {
|
49
|
+
steps {
|
50
|
+
sh 'JUNIT_OUTPUT_DIR=test/reports/rails-4 bundle exec appraisal rails-4 rake'
|
51
|
+
}
|
52
|
+
|
53
|
+
post {
|
54
|
+
always { junit '*/reports/rails-4/*.xml' }
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
stage('Rails 5') {
|
59
|
+
steps {
|
60
|
+
sh 'JUNIT_OUTPUT_DIR=test/reports/rails-5 bundle exec appraisal rails-5 rake'
|
61
|
+
}
|
62
|
+
|
63
|
+
post {
|
64
|
+
always { junit '*/reports/rails-5/*.xml' }
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
stage('Rails 6') {
|
69
|
+
steps {
|
70
|
+
sh 'JUNIT_OUTPUT_DIR=test/reports/rails-6 bundle exec appraisal rails-6 rake'
|
71
|
+
}
|
72
|
+
|
73
|
+
post {
|
74
|
+
always { junit '*/reports/rails-6/*.xml' }
|
75
|
+
}
|
38
76
|
}
|
39
77
|
}
|
78
|
+
|
40
79
|
post {
|
41
|
-
always { junit '*/reports/*.xml' }
|
42
80
|
success { updateGitHubStatus('clean-build', 'success', 'Unit tests.') }
|
43
81
|
failure { updateGitHubStatus('clean-build', 'failure', 'Unit tests.') }
|
44
82
|
}
|
@@ -52,7 +90,7 @@ void updateGitHubStatus(String context, String status, String description) {
|
|
52
90
|
sha: env.GIT_COMMIT,
|
53
91
|
description: description,
|
54
92
|
context: context,
|
55
|
-
targetURL: env.
|
93
|
+
targetURL: env.RUN_DISPLAY_URL,
|
56
94
|
token: env.GITHUB_TOKEN,
|
57
95
|
status: status
|
58
96
|
])
|
data/Appraisals
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
appraise "rails-4" do
|
4
|
+
gem 'actionmailer', '~> 4.2'
|
5
|
+
gem 'actionpack', '~> 4.2'
|
6
|
+
gem 'activesupport', '~> 4.2'
|
7
|
+
end
|
8
|
+
|
9
|
+
appraise "rails-5" do
|
10
|
+
gem 'actionmailer', '~> 5.2'
|
11
|
+
gem 'actionpack', '~> 5.2'
|
12
|
+
gem 'activesupport', '~> 5.2'
|
13
|
+
end
|
14
|
+
|
15
|
+
appraise "rails-6" do
|
16
|
+
gem 'actionmailer', '~> 6.0'
|
17
|
+
gem 'actionpack', '~> 6.0'
|
18
|
+
gem 'activesupport', '~> 6.0'
|
19
|
+
end
|
data/CHANGELOG.md
CHANGED
@@ -4,8 +4,31 @@ 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.4] - 2020-08-10
|
8
|
+
### Fixed
|
9
|
+
- `ExceptionHandling.logger = nil` no longer displays an "implicit extend" deprecation warning.
|
10
|
+
|
11
|
+
## [2.4.3] - 2020-05-14
|
12
|
+
### Deprecated
|
13
|
+
- In `ExceptionHandling.logger=`, implicit `logger.extend ContextualLogger::LoggerMixin` is now deprecated.
|
14
|
+
This will be removed in version 3.0 and an `ArgumentError` will be raised if the logger
|
15
|
+
doesn't have that mixin. Instead of this implicit behavior, you should explicitly either `extend`
|
16
|
+
your logger instance or `include` that mixin into your `Logger` class.
|
17
|
+
|
18
|
+
## [2.4.2] - 2020-05-11
|
19
|
+
### Added
|
20
|
+
- Added support for rails 5 and 6.
|
21
|
+
- Added appraisal tests for all supported rails version: 4/5/6
|
22
|
+
|
23
|
+
### Changed
|
24
|
+
- Updated various test to be compatible with rails version 4/5/6
|
25
|
+
- Updated the CI pipeline to test against all three supported versions of rails
|
26
|
+
|
7
27
|
## [2.4.1] - 2020-04-29
|
8
28
|
### Changed
|
9
29
|
- No longer depends on hobo_support. Uses invoca-utils 0.3 instead.
|
10
30
|
|
31
|
+
[2.4.3]: https://github.com/Invoca/exception_handling/compare/v2.4.3...v2.4.4
|
32
|
+
[2.4.3]: https://github.com/Invoca/exception_handling/compare/v2.4.2...v2.4.3
|
33
|
+
[2.4.2]: https://github.com/Invoca/exception_handling/compare/v2.4.1...v2.4.2
|
11
34
|
[2.4.1]: https://github.com/Invoca/exception_handling/compare/v2.4.0...v2.4.1
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -8,11 +8,11 @@ GIT
|
|
8
8
|
PATH
|
9
9
|
remote: .
|
10
10
|
specs:
|
11
|
-
exception_handling (2.4.
|
12
|
-
actionmailer (
|
13
|
-
actionpack (
|
14
|
-
activesupport (
|
15
|
-
contextual_logger
|
11
|
+
exception_handling (2.4.4)
|
12
|
+
actionmailer (>= 4.2, < 7.0)
|
13
|
+
actionpack (>= 4.2, < 7.0)
|
14
|
+
activesupport (>= 4.2, < 7.0)
|
15
|
+
contextual_logger (~> 0.7)
|
16
16
|
eventmachine (~> 1.0)
|
17
17
|
invoca-utils (~> 0.3)
|
18
18
|
|
@@ -47,11 +47,15 @@ GEM
|
|
47
47
|
thread_safe (~> 0.3, >= 0.3.4)
|
48
48
|
tzinfo (~> 1.1)
|
49
49
|
ansi (1.5.0)
|
50
|
+
appraisal (2.2.0)
|
51
|
+
bundler
|
52
|
+
rake
|
53
|
+
thor (>= 0.14.0)
|
50
54
|
ast (2.4.0)
|
51
55
|
builder (3.2.3)
|
52
56
|
coderay (1.1.2)
|
53
57
|
concurrent-ruby (1.1.5)
|
54
|
-
contextual_logger (0.
|
58
|
+
contextual_logger (0.8.0)
|
55
59
|
activesupport
|
56
60
|
json
|
57
61
|
crass (1.0.6)
|
@@ -61,16 +65,16 @@ GEM
|
|
61
65
|
activesupport (>= 4.2.0)
|
62
66
|
i18n (0.9.5)
|
63
67
|
concurrent-ruby (~> 1.0)
|
64
|
-
invoca-utils (0.
|
68
|
+
invoca-utils (0.4.1)
|
65
69
|
jaro_winkler (1.5.3)
|
66
|
-
json (2.3.
|
67
|
-
loofah (2.
|
70
|
+
json (2.3.1)
|
71
|
+
loofah (2.6.0)
|
68
72
|
crass (~> 1.0.2)
|
69
73
|
nokogiri (>= 1.5.9)
|
70
74
|
mail (2.7.1)
|
71
75
|
mini_mime (>= 0.1.1)
|
72
76
|
method_source (0.9.2)
|
73
|
-
mini_mime (1.0.
|
77
|
+
mini_mime (1.0.2)
|
74
78
|
mini_portile2 (2.4.0)
|
75
79
|
minitest (5.11.3)
|
76
80
|
minitest-reporters (1.0.20)
|
@@ -78,7 +82,7 @@ GEM
|
|
78
82
|
builder
|
79
83
|
minitest (>= 5.0)
|
80
84
|
ruby-progressbar
|
81
|
-
nokogiri (1.10.
|
85
|
+
nokogiri (1.10.10)
|
82
86
|
mini_portile2 (~> 2.4.0)
|
83
87
|
parallel (1.17.0)
|
84
88
|
parser (2.6.3.0)
|
@@ -86,7 +90,7 @@ GEM
|
|
86
90
|
pry (0.12.2)
|
87
91
|
coderay (~> 1.1.0)
|
88
92
|
method_source (~> 0.9.0)
|
89
|
-
rack (1.6.
|
93
|
+
rack (1.6.13)
|
90
94
|
rack-test (0.6.3)
|
91
95
|
rack (>= 1.0)
|
92
96
|
rails-deprecated_sanitizer (1.0.3)
|
@@ -95,8 +99,8 @@ GEM
|
|
95
99
|
activesupport (>= 4.2.0, < 5.0)
|
96
100
|
nokogiri (~> 1.6)
|
97
101
|
rails-deprecated_sanitizer (>= 1.0.1)
|
98
|
-
rails-html-sanitizer (1.0
|
99
|
-
loofah (~> 2.
|
102
|
+
rails-html-sanitizer (1.3.0)
|
103
|
+
loofah (~> 2.3)
|
100
104
|
rainbow (3.0.0)
|
101
105
|
rake (13.0.1)
|
102
106
|
rr (1.2.1)
|
@@ -114,6 +118,7 @@ GEM
|
|
114
118
|
shoulda-context (1.2.2)
|
115
119
|
shoulda-matchers (3.1.3)
|
116
120
|
activesupport (>= 4.0.0)
|
121
|
+
thor (1.0.1)
|
117
122
|
thread_safe (0.3.6)
|
118
123
|
tzinfo (1.2.5)
|
119
124
|
thread_safe (~> 0.1)
|
@@ -123,6 +128,7 @@ PLATFORMS
|
|
123
128
|
ruby
|
124
129
|
|
125
130
|
DEPENDENCIES
|
131
|
+
appraisal (~> 2.2)
|
126
132
|
exception_handling!
|
127
133
|
honeybadger (= 3.3.1.pre.1)!
|
128
134
|
minitest
|
data/README.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
Enable emails for your exceptions that occur in your application!
|
4
4
|
|
5
|
+
## Dependencies
|
6
|
+
- Ruby 2.6
|
7
|
+
- Rails >= 4.2, < 7
|
8
|
+
|
5
9
|
## Installation
|
6
10
|
|
7
11
|
Add this line to your application's Gemfile:
|
@@ -89,15 +93,15 @@ There is another hook available intended for custom actions after an error email
|
|
89
93
|
else
|
90
94
|
Invoca::Metrics::Client.metrics.counter("exception_handling/exception")
|
91
95
|
end
|
92
|
-
|
96
|
+
|
93
97
|
case honeybadger_status
|
94
98
|
when :success
|
95
99
|
Invoca::Metrics::Client.metrics.counter("exception_handling.honeybadger.success")
|
96
|
-
when :failure
|
100
|
+
when :failure
|
97
101
|
Invoca::Metrics::Client.metrics.counter("exception_handling.honeybadger.failure")
|
98
102
|
when :skipped
|
99
103
|
Invoca::Metrics::Client.metrics.counter("exception_handling.honeybadger.skipped")
|
100
|
-
end
|
104
|
+
end
|
101
105
|
end
|
102
106
|
ExceptionHandling.post_log_error_hook = method(:log_error_metrics)
|
103
107
|
|
data/exception_handling.gemspec
CHANGED
@@ -20,10 +20,10 @@ Gem::Specification.new do |spec|
|
|
20
20
|
"allowed_push_host" => "https://rubygems.org"
|
21
21
|
}
|
22
22
|
|
23
|
-
spec.add_dependency 'actionmailer',
|
24
|
-
spec.add_dependency 'actionpack',
|
25
|
-
spec.add_dependency 'activesupport',
|
26
|
-
spec.add_dependency 'contextual_logger'
|
27
|
-
spec.add_dependency 'eventmachine',
|
28
|
-
spec.add_dependency 'invoca-utils',
|
23
|
+
spec.add_dependency 'actionmailer', '>= 4.2', '< 7.0'
|
24
|
+
spec.add_dependency 'actionpack', '>= 4.2', '< 7.0'
|
25
|
+
spec.add_dependency 'activesupport', '>= 4.2', '< 7.0'
|
26
|
+
spec.add_dependency 'contextual_logger', '~> 0.7'
|
27
|
+
spec.add_dependency 'eventmachine', '~> 1.0'
|
28
|
+
spec.add_dependency 'invoca-utils', '~> 0.3'
|
29
29
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal", "~> 2.2"
|
6
|
+
gem "honeybadger", "3.3.1-1", git: "git@github.com:Invoca/honeybadger-ruby", ref: "bb5f2b8a86e4147c38a6270d39ad610fab4dd5e6"
|
7
|
+
gem "minitest"
|
8
|
+
gem "minitest-reporters"
|
9
|
+
gem "pry"
|
10
|
+
gem "rake"
|
11
|
+
gem "rr"
|
12
|
+
gem "rubocop"
|
13
|
+
gem "shoulda"
|
14
|
+
gem "actionmailer", "~> 4.2"
|
15
|
+
gem "actionpack", "~> 4.2"
|
16
|
+
gem "activesupport", "~> 4.2"
|
17
|
+
|
18
|
+
gemspec path: "../"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal", "~> 2.2"
|
6
|
+
gem "honeybadger", "3.3.1-1", git: "git@github.com:Invoca/honeybadger-ruby", ref: "bb5f2b8a86e4147c38a6270d39ad610fab4dd5e6"
|
7
|
+
gem "minitest"
|
8
|
+
gem "minitest-reporters"
|
9
|
+
gem "pry"
|
10
|
+
gem "rake"
|
11
|
+
gem "rr"
|
12
|
+
gem "rubocop"
|
13
|
+
gem "shoulda"
|
14
|
+
gem "actionmailer", "~> 5.2"
|
15
|
+
gem "actionpack", "~> 5.2"
|
16
|
+
gem "activesupport", "~> 5.2"
|
17
|
+
|
18
|
+
gemspec path: "../"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal", "~> 2.2"
|
6
|
+
gem "honeybadger", "3.3.1-1", git: "git@github.com:Invoca/honeybadger-ruby", ref: "bb5f2b8a86e4147c38a6270d39ad610fab4dd5e6"
|
7
|
+
gem "minitest"
|
8
|
+
gem "minitest-reporters"
|
9
|
+
gem "pry"
|
10
|
+
gem "rake"
|
11
|
+
gem "rr"
|
12
|
+
gem "rubocop"
|
13
|
+
gem "shoulda"
|
14
|
+
gem "actionmailer", "~> 6.0"
|
15
|
+
gem "actionpack", "~> 6.0"
|
16
|
+
gem "activesupport", "~> 6.0"
|
17
|
+
|
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.
|
60
|
+
@logger = if logger.nil? || 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 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
@@ -9,7 +9,9 @@ require 'shoulda'
|
|
9
9
|
require 'rr'
|
10
10
|
require 'minitest/autorun'
|
11
11
|
require "minitest/reporters"
|
12
|
-
|
12
|
+
|
13
|
+
junit_ouptut_dir = ENV["JUNIT_OUTPUT_DIR"].presence || "test/reports"
|
14
|
+
Minitest::Reporters.use!([Minitest::Reporters::DefaultReporter.new, Minitest::Reporters::JUnitReporter.new(junit_ouptut_dir)])
|
13
15
|
|
14
16
|
require 'pry'
|
15
17
|
require 'honeybadger'
|
@@ -21,10 +23,13 @@ require 'exception_handling/testing'
|
|
21
23
|
ActiveSupport::TestCase.test_order = :sorted
|
22
24
|
|
23
25
|
class LoggerStub
|
24
|
-
include ContextualLogger
|
25
|
-
attr_accessor :logged
|
26
|
+
include ContextualLogger::LoggerMixin
|
27
|
+
attr_accessor :logged, :level
|
26
28
|
|
27
29
|
def initialize
|
30
|
+
@level = Logger::Severity::DEBUG
|
31
|
+
@progname = nil
|
32
|
+
@logdev = nil
|
28
33
|
clear
|
29
34
|
end
|
30
35
|
|
@@ -52,7 +52,7 @@ module ExceptionHandling
|
|
52
52
|
setup do
|
53
53
|
@filename = File.expand_path('../../../config/exception_filters.yml', __dir__)
|
54
54
|
@exception_catalog = ExceptionCatalog.new(@filename)
|
55
|
-
assert_nothing_raised
|
55
|
+
assert_nothing_raised do
|
56
56
|
@exception_catalog.send :load_file
|
57
57
|
end
|
58
58
|
end
|
@@ -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,35 @@ 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 "allow logger = nil (no deprecation warning)" do
|
130
|
+
mock(STDERR).puts(/DEPRECATION WARNING/).never
|
131
|
+
ExceptionHandling.logger = nil
|
132
|
+
end
|
133
|
+
|
134
|
+
should "[deprecated] mix in ContextualLogger::Mixin if not there" do
|
135
|
+
mock(STDERR).puts(/DEPRECATION WARNING: implicit extend with ContextualLogger::LoggerMixin is deprecated and will be removed from exception_handling 3\.0/)
|
136
|
+
logger = Logger.new('/dev/null')
|
137
|
+
ancestors = logger.singleton_class.ancestors.*.name
|
138
|
+
|
139
|
+
ExceptionHandling.logger = logger
|
140
|
+
assert_not_equal ancestors, ExceptionHandling.logger.singleton_class.ancestors.*.name
|
141
|
+
assert_kind_of ContextualLogger::LoggerMixin, ExceptionHandling.logger
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
112
145
|
context "#log_error" do
|
113
146
|
should "take in additional logging context hash and pass it to the logger" do
|
114
147
|
ExceptionHandling.log_error('This is an Error', 'This is the prefix context', service_name: 'exception_handling')
|
@@ -168,7 +201,6 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
|
|
168
201
|
end
|
169
202
|
|
170
203
|
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
204
|
@honeybadger_status = nil
|
173
205
|
ExceptionHandling.post_log_error_hook = method(:log_error_callback_config)
|
174
206
|
|
@@ -185,7 +217,6 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
|
|
185
217
|
end
|
186
218
|
|
187
219
|
should "plumb treat_like_warning and logged_to_honeybadger to log error hook" do
|
188
|
-
@fail_count = 0
|
189
220
|
@honeybadger_status = nil
|
190
221
|
ExceptionHandling.post_log_error_hook = method(:log_error_callback_config)
|
191
222
|
ExceptionHandling.log_error(StandardError.new("Some Exception"), "mooo", treat_like_warning: true)
|
@@ -306,9 +337,24 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
|
|
306
337
|
ExceptionHandling.ensure_safe { raise ArgumentError, "blah" }
|
307
338
|
end
|
308
339
|
|
309
|
-
|
310
|
-
|
311
|
-
|
340
|
+
if ActionView::VERSION::MAJOR >= 5
|
341
|
+
should "log an exception with call stack if an ActionView template exception is raised." do
|
342
|
+
mock(ExceptionHandling.logger).fatal(/\(Error:\d+\) ActionView::Template::Error \(blah\):\n /, anything)
|
343
|
+
ExceptionHandling.ensure_safe do
|
344
|
+
begin
|
345
|
+
# Rails 5 made the switch from ActionView::TemplateError taking in the original exception
|
346
|
+
# as an argument to using the $! global to extract the original exception
|
347
|
+
raise ArgumentError, "blah"
|
348
|
+
rescue
|
349
|
+
raise ActionView::TemplateError.new({})
|
350
|
+
end
|
351
|
+
end
|
352
|
+
end
|
353
|
+
else
|
354
|
+
should "log an exception with call stack if an ActionView template exception is raised." do
|
355
|
+
mock(ExceptionHandling.logger).fatal(/\(Error:\d+\) ActionView::Template::Error \(blah\):\n /, anything)
|
356
|
+
ExceptionHandling.ensure_safe { raise ActionView::TemplateError.new({}, ArgumentError.new("blah")) }
|
357
|
+
end
|
312
358
|
end
|
313
359
|
|
314
360
|
should "should not log an exception if an exception is not raised." do
|
@@ -643,7 +689,6 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
|
|
643
689
|
end
|
644
690
|
|
645
691
|
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
|
646
|
-
@fail_count = 0
|
647
692
|
@honeybadger_status = nil
|
648
693
|
ExceptionHandling.post_log_error_hook = method(:log_error_callback_config)
|
649
694
|
filter_list = {
|
@@ -662,7 +707,6 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
|
|
662
707
|
end
|
663
708
|
|
664
709
|
should "call log error callback with logged_to_honeybadger set to false if an error occurs while attempting to notify honeybadger" do
|
665
|
-
@fail_count = 0
|
666
710
|
@honeybadger_status = nil
|
667
711
|
ExceptionHandling.post_log_error_hook = method(:log_error_callback_config)
|
668
712
|
mock(Honeybadger).notify.with_any_args { raise "Honeybadger Notification Failure" }
|
@@ -671,7 +715,6 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
|
|
671
715
|
end
|
672
716
|
|
673
717
|
should "call log error callback with logged_to_honeybadger set to false on unsuccessful honeybadger notification" do
|
674
|
-
@fail_count = 0
|
675
718
|
@honeybadger_status = nil
|
676
719
|
ExceptionHandling.post_log_error_hook = method(:log_error_callback_config)
|
677
720
|
mock(Honeybadger).notify.with_any_args { false }
|
@@ -680,7 +723,6 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
|
|
680
723
|
end
|
681
724
|
|
682
725
|
should "call log error callback with logged_to_honeybadger set to true on successful honeybadger notification" do
|
683
|
-
@fail_count = 0
|
684
726
|
@honeybadger_status = nil
|
685
727
|
ExceptionHandling.post_log_error_hook = method(:log_error_callback_config)
|
686
728
|
mock(Honeybadger).notify.with_any_args { '06220c5a-b471-41e5-baeb-de247da45a56' }
|
metadata
CHANGED
@@ -1,71 +1,89 @@
|
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Invoca
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '4.2'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '7.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '4.2'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '7.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: actionpack
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- - "
|
37
|
+
- - ">="
|
32
38
|
- !ruby/object:Gem::Version
|
33
39
|
version: '4.2'
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '7.0'
|
34
43
|
type: :runtime
|
35
44
|
prerelease: false
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
37
46
|
requirements:
|
38
|
-
- - "
|
47
|
+
- - ">="
|
39
48
|
- !ruby/object:Gem::Version
|
40
49
|
version: '4.2'
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '7.0'
|
41
53
|
- !ruby/object:Gem::Dependency
|
42
54
|
name: activesupport
|
43
55
|
requirement: !ruby/object:Gem::Requirement
|
44
56
|
requirements:
|
45
|
-
- - "
|
57
|
+
- - ">="
|
46
58
|
- !ruby/object:Gem::Version
|
47
59
|
version: '4.2'
|
60
|
+
- - "<"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '7.0'
|
48
63
|
type: :runtime
|
49
64
|
prerelease: false
|
50
65
|
version_requirements: !ruby/object:Gem::Requirement
|
51
66
|
requirements:
|
52
|
-
- - "
|
67
|
+
- - ">="
|
53
68
|
- !ruby/object:Gem::Version
|
54
69
|
version: '4.2'
|
70
|
+
- - "<"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '7.0'
|
55
73
|
- !ruby/object:Gem::Dependency
|
56
74
|
name: contextual_logger
|
57
75
|
requirement: !ruby/object:Gem::Requirement
|
58
76
|
requirements:
|
59
|
-
- - "
|
77
|
+
- - "~>"
|
60
78
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
79
|
+
version: '0.7'
|
62
80
|
type: :runtime
|
63
81
|
prerelease: false
|
64
82
|
version_requirements: !ruby/object:Gem::Requirement
|
65
83
|
requirements:
|
66
|
-
- - "
|
84
|
+
- - "~>"
|
67
85
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
86
|
+
version: '0.7'
|
69
87
|
- !ruby/object:Gem::Dependency
|
70
88
|
name: eventmachine
|
71
89
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,6 +124,7 @@ files:
|
|
106
124
|
- ".jenkins/ruby_build_pod.yml"
|
107
125
|
- ".rubocop.yml"
|
108
126
|
- ".ruby-version"
|
127
|
+
- Appraisals
|
109
128
|
- CHANGELOG.md
|
110
129
|
- Gemfile
|
111
130
|
- Gemfile.lock
|
@@ -114,6 +133,10 @@ files:
|
|
114
133
|
- Rakefile
|
115
134
|
- config/exception_filters.yml
|
116
135
|
- exception_handling.gemspec
|
136
|
+
- gemfiles/.bundle/config
|
137
|
+
- gemfiles/rails_4.gemfile
|
138
|
+
- gemfiles/rails_5.gemfile
|
139
|
+
- gemfiles/rails_6.gemfile
|
117
140
|
- lib/exception_handling.rb
|
118
141
|
- lib/exception_handling/exception_catalog.rb
|
119
142
|
- lib/exception_handling/exception_description.rb
|