exception_handling 2.4.1 → 2.4.4.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 +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 +15 -2
- 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 +46 -9
- metadata +40 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e18b802032b87ce35aee9ab2a3eebd4177686e5ff9bca74ed0f32e5c266e517
|
4
|
+
data.tar.gz: 12a870a3f4ed762298cd13a045edba06b470c9aea9d29324b0642163779610d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 121a94c85c7dad8f56003674dcee796e1dd80e7e96c31012e0343614ca6375f192734c4c0b2e4fd8025f4f66d8cc306ed157a28a8bf213b5ec94af6c5a7dc65d
|
7
|
+
data.tar.gz: 20d94f407272de21c341362a18be4500a984aa6f2fad05d9706ee1ed6943d2537f281aff315c48e028095dcdfbe491bb0ef3cc32c35eff6473ab176259ab30ab
|
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] - Unreleased
|
8
|
+
### Changed
|
9
|
+
- Calling `log_warning` will now log with Severity::WARNING rather than FATAL.
|
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.4]: 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.1)
|
12
|
-
actionmailer (
|
13
|
-
actionpack (
|
14
|
-
activesupport (
|
15
|
-
contextual_logger
|
11
|
+
exception_handling (2.4.4.pre.1)
|
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.9.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.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 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)
|
@@ -213,7 +220,13 @@ module ExceptionHandling # never included
|
|
213
220
|
#
|
214
221
|
def write_exception_to_log(ex, exception_context, timestamp, log_context = {})
|
215
222
|
ActiveSupport::Deprecation.silence do
|
216
|
-
|
223
|
+
log_message = "\nExceptionHandlingError (Error:#{timestamp}) #{ex.class} #{exception_context} (#{encode_utf8(ex.message.to_s)}):\n " + clean_backtrace(ex).join("\n ") + "\n\n"
|
224
|
+
|
225
|
+
if ex.is_a?(Warning)
|
226
|
+
ExceptionHandling.logger.warn(log_message, log_context)
|
227
|
+
else
|
228
|
+
ExceptionHandling.logger.fatal(log_message, log_context)
|
229
|
+
end
|
217
230
|
end
|
218
231
|
end
|
219
232
|
|
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,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)
|
@@ -306,9 +332,24 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
|
|
306
332
|
ExceptionHandling.ensure_safe { raise ArgumentError, "blah" }
|
307
333
|
end
|
308
334
|
|
309
|
-
|
310
|
-
|
311
|
-
|
335
|
+
if ActionView::VERSION::MAJOR >= 5
|
336
|
+
should "log an exception with call stack if an ActionView template exception is raised." do
|
337
|
+
mock(ExceptionHandling.logger).fatal(/\(Error:\d+\) ActionView::Template::Error \(blah\):\n /, anything)
|
338
|
+
ExceptionHandling.ensure_safe do
|
339
|
+
begin
|
340
|
+
# Rails 5 made the switch from ActionView::TemplateError taking in the original exception
|
341
|
+
# as an argument to using the $! global to extract the original exception
|
342
|
+
raise ArgumentError, "blah"
|
343
|
+
rescue
|
344
|
+
raise ActionView::TemplateError.new({})
|
345
|
+
end
|
346
|
+
end
|
347
|
+
end
|
348
|
+
else
|
349
|
+
should "log an exception with call stack if an ActionView template exception is raised." do
|
350
|
+
mock(ExceptionHandling.logger).fatal(/\(Error:\d+\) ActionView::Template::Error \(blah\):\n /, anything)
|
351
|
+
ExceptionHandling.ensure_safe { raise ActionView::TemplateError.new({}, ArgumentError.new("blah")) }
|
352
|
+
end
|
312
353
|
end
|
313
354
|
|
314
355
|
should "should not log an exception if an exception is not raised." do
|
@@ -643,7 +684,6 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
|
|
643
684
|
end
|
644
685
|
|
645
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
|
646
|
-
@fail_count = 0
|
647
687
|
@honeybadger_status = nil
|
648
688
|
ExceptionHandling.post_log_error_hook = method(:log_error_callback_config)
|
649
689
|
filter_list = {
|
@@ -662,7 +702,6 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
|
|
662
702
|
end
|
663
703
|
|
664
704
|
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
705
|
@honeybadger_status = nil
|
667
706
|
ExceptionHandling.post_log_error_hook = method(:log_error_callback_config)
|
668
707
|
mock(Honeybadger).notify.with_any_args { raise "Honeybadger Notification Failure" }
|
@@ -671,7 +710,6 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
|
|
671
710
|
end
|
672
711
|
|
673
712
|
should "call log error callback with logged_to_honeybadger set to false on unsuccessful honeybadger notification" do
|
674
|
-
@fail_count = 0
|
675
713
|
@honeybadger_status = nil
|
676
714
|
ExceptionHandling.post_log_error_hook = method(:log_error_callback_config)
|
677
715
|
mock(Honeybadger).notify.with_any_args { false }
|
@@ -680,7 +718,6 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
|
|
680
718
|
end
|
681
719
|
|
682
720
|
should "call log error callback with logged_to_honeybadger set to true on successful honeybadger notification" do
|
683
|
-
@fail_count = 0
|
684
721
|
@honeybadger_status = nil
|
685
722
|
ExceptionHandling.post_log_error_hook = method(:log_error_callback_config)
|
686
723
|
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.1
|
4
|
+
version: 2.4.4.pre.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Invoca
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-18 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
|
@@ -145,7 +168,7 @@ licenses: []
|
|
145
168
|
metadata:
|
146
169
|
source_code_uri: https://github.com/Invoca/exception_handling
|
147
170
|
allowed_push_host: https://rubygems.org
|
148
|
-
post_install_message:
|
171
|
+
post_install_message:
|
149
172
|
rdoc_options: []
|
150
173
|
require_paths:
|
151
174
|
- lib
|
@@ -156,12 +179,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
179
|
version: '0'
|
157
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
181
|
requirements:
|
159
|
-
- - "
|
182
|
+
- - ">"
|
160
183
|
- !ruby/object:Gem::Version
|
161
|
-
version:
|
184
|
+
version: 1.3.1
|
162
185
|
requirements: []
|
163
186
|
rubygems_version: 3.0.3
|
164
|
-
signing_key:
|
187
|
+
signing_key:
|
165
188
|
specification_version: 4
|
166
189
|
summary: Invoca's exception handling logger/emailer layer, based on exception_notifier.
|
167
190
|
Works with Rails or EventMachine or EventMachine+Synchrony.
|