exception_handling 2.17.0.pre.tstarck.1 → 3.0.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.
Files changed (48) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +0 -3
  3. data/.ruby-version +1 -1
  4. data/Gemfile +16 -12
  5. data/Gemfile.lock +138 -153
  6. data/README.md +21 -90
  7. data/Rakefile +11 -8
  8. data/exception_handling.gemspec +10 -14
  9. data/lib/exception_handling/exception_info.rb +11 -15
  10. data/lib/exception_handling/honeybadger_callbacks.rb +59 -0
  11. data/lib/exception_handling/log_stub_error.rb +1 -2
  12. data/lib/exception_handling/methods.rb +53 -6
  13. data/lib/exception_handling/testing.rb +10 -20
  14. data/lib/exception_handling/version.rb +1 -1
  15. data/lib/exception_handling.rb +34 -135
  16. data/semaphore_ci/setup.sh +3 -0
  17. data/{spec → test}/helpers/exception_helpers.rb +2 -2
  18. data/{spec/spec_helper.rb → test/test_helper.rb} +45 -75
  19. data/test/unit/exception_handling/exception_catalog_test.rb +85 -0
  20. data/test/unit/exception_handling/exception_description_test.rb +82 -0
  21. data/{spec/unit/exception_handling/exception_info_spec.rb → test/unit/exception_handling/exception_info_test.rb} +114 -170
  22. data/test/unit/exception_handling/honeybadger_callbacks_test.rb +122 -0
  23. data/{spec/unit/exception_handling/log_error_stub_spec.rb → test/unit/exception_handling/log_error_stub_test.rb} +22 -38
  24. data/{spec/unit/exception_handling/mailer_spec.rb → test/unit/exception_handling/mailer_test.rb} +18 -17
  25. data/test/unit/exception_handling/methods_test.rb +84 -0
  26. data/test/unit/exception_handling/sensu_test.rb +52 -0
  27. data/test/unit/exception_handling_test.rb +1109 -0
  28. metadata +59 -99
  29. data/.github/CODEOWNERS +0 -1
  30. data/.github/workflows/pipeline.yml +0 -36
  31. data/.rspec +0 -3
  32. data/.tool-versions +0 -1
  33. data/Appraisals +0 -19
  34. data/CHANGELOG.md +0 -149
  35. data/gemfiles/rails_5.gemfile +0 -18
  36. data/gemfiles/rails_6.gemfile +0 -18
  37. data/gemfiles/rails_7.gemfile +0 -18
  38. data/lib/exception_handling/escalate_callback.rb +0 -19
  39. data/lib/exception_handling/logging_methods.rb +0 -27
  40. data/spec/rake_test_warning_false.rb +0 -20
  41. data/spec/unit/exception_handling/escalate_callback_spec.rb +0 -81
  42. data/spec/unit/exception_handling/exception_catalog_spec.rb +0 -85
  43. data/spec/unit/exception_handling/exception_description_spec.rb +0 -82
  44. data/spec/unit/exception_handling/logging_methods_spec.rb +0 -38
  45. data/spec/unit/exception_handling/methods_spec.rb +0 -105
  46. data/spec/unit/exception_handling/sensu_spec.rb +0 -51
  47. data/spec/unit/exception_handling_spec.rb +0 -1465
  48. /data/{spec → test}/helpers/controller_helpers.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 4074e67f0ede6cb73665a058c3cd09b02e7518e0fb4d0860d0ce4378aa4023b6
4
- data.tar.gz: e2d3726622a44753b679de1f645d3bbf40780c8d8829f46e7803661a7f583100
2
+ SHA1:
3
+ metadata.gz: 6aee76b81d1d4742150afdeb95f8a6f544671a3f
4
+ data.tar.gz: 4822461573c54709a2d977b82e47de35cecfa51e
5
5
  SHA512:
6
- metadata.gz: aa6b1574ba37ac1aee58bfb3bbfc9c15a083d255fa031c1b61dc205dad06c7a1bbee62c6fc6a1e5d24d341f88fa01806cef133cba8beb9f1ad34f0278dbe2848
7
- data.tar.gz: e1f4e2e4dc2ff78d948a31eabc2091d7c853f117f2f03c300ee90b4d2b362d59dfe89590d5ae3f8b2949d40e40a09d60ed418786c4dbee9180fb188b590296b9
6
+ metadata.gz: de1c0ab7cb7e7a493ce5f8c8d155ad98450edc891636e2d8e9d82ec2d8bdc312b45ba96f5902e0bc2d70adb35c0e4e20317bbea7d72d54625d7c2764ac2fb374
7
+ data.tar.gz: 7546dd2be9a2701d360cdd5fee3ea0e93b9a26e0072c835940659d5244c0e625743924cdde737fee08a7d5f909d03df1752b8e9ae6b8a7d354b62a77d8b89a57
data/.gitignore CHANGED
@@ -1,6 +1,3 @@
1
1
  .idea
2
2
  .DS_Store
3
3
  .rubocop-http*
4
- spec/reports/*
5
- gemfiles/*.lock
6
- pkg/
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.5
1
+ 2.4.2
data/Gemfile CHANGED
@@ -2,17 +2,21 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
+ # Specify your gem's dependencies in attr_default.gemspec
5
6
  gemspec
6
7
 
7
- gem 'actionmailer', '~> 6.0'
8
- gem 'actionpack', '~> 6.0'
9
- gem 'activesupport', '~> 6.0'
10
- gem 'appraisal', '~> 2.2'
11
- gem 'honeybadger', '~> 4.11'
12
- gem 'pry'
13
- gem 'pry-byebug'
14
- gem 'rake'
15
- gem 'rspec'
16
- gem 'rspec_junit_formatter'
17
- gem 'rubocop'
18
- gem 'test-unit'
8
+ gem 'actionmailer', '>= 4.2.11.1'
9
+ gem 'actionpack', '>= 4.2.11.1'
10
+ gem 'activesupport', '>= 4.2.11.1'
11
+
12
+ group :development do
13
+ gem 'pry'
14
+ gem 'rake', '>=0.9'
15
+ gem 'rr'
16
+ gem 'rubocop'
17
+ gem 'shoulda', '> 3.1.1'
18
+ end
19
+
20
+ group :test do
21
+ gem 'honeybadger', '3.3.1-1', git: 'git@github.com:Invoca/honeybadger-ruby', ref: 'bb5f2b8a86e4147c38a6270d39ad610fab4dd5e6'
22
+ end
data/Gemfile.lock CHANGED
@@ -1,182 +1,167 @@
1
+ GIT
2
+ remote: git@github.com:Invoca/honeybadger-ruby
3
+ revision: bb5f2b8a86e4147c38a6270d39ad610fab4dd5e6
4
+ ref: bb5f2b8a86e4147c38a6270d39ad610fab4dd5e6
5
+ specs:
6
+ honeybadger (3.3.1.pre.1)
7
+
1
8
  PATH
2
9
  remote: .
3
10
  specs:
4
- exception_handling (2.17.0.pre.tstarck.1)
5
- actionmailer (>= 5.2)
6
- actionpack (>= 5.2)
7
- activesupport (>= 5.2)
8
- contextual_logger (~> 1.0)
9
- escalate (~> 0.3)
11
+ exception_handling (3.0.pre.1)
12
+ actionmailer (~> 4.2)
13
+ actionpack (~> 4.2)
14
+ activesupport (~> 4.2)
15
+ contextual_logger
10
16
  eventmachine (~> 1.0)
11
- invoca-utils (~> 0.3)
12
- net-smtp
13
- psych (~> 3.0)
17
+ hobo_support
18
+ invoca-utils (~> 0.0)
14
19
 
15
20
  GEM
16
21
  remote: https://rubygems.org/
17
22
  specs:
18
- actionmailer (6.1.7.6)
19
- actionpack (= 6.1.7.6)
20
- actionview (= 6.1.7.6)
21
- activejob (= 6.1.7.6)
22
- activesupport (= 6.1.7.6)
23
+ actionmailer (4.2.11.1)
24
+ actionpack (= 4.2.11.1)
25
+ actionview (= 4.2.11.1)
26
+ activejob (= 4.2.11.1)
23
27
  mail (~> 2.5, >= 2.5.4)
24
- rails-dom-testing (~> 2.0)
25
- actionpack (6.1.7.6)
26
- actionview (= 6.1.7.6)
27
- activesupport (= 6.1.7.6)
28
- rack (~> 2.0, >= 2.0.9)
29
- rack-test (>= 0.6.3)
30
- rails-dom-testing (~> 2.0)
31
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
32
- actionview (6.1.7.6)
33
- activesupport (= 6.1.7.6)
28
+ rails-dom-testing (~> 1.0, >= 1.0.5)
29
+ actionpack (4.2.11.1)
30
+ actionview (= 4.2.11.1)
31
+ activesupport (= 4.2.11.1)
32
+ rack (~> 1.6)
33
+ rack-test (~> 0.6.2)
34
+ rails-dom-testing (~> 1.0, >= 1.0.5)
35
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
36
+ actionview (4.2.11.1)
37
+ activesupport (= 4.2.11.1)
38
+ builder (~> 3.1)
39
+ erubis (~> 2.7.0)
40
+ rails-dom-testing (~> 1.0, >= 1.0.5)
41
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
42
+ activejob (4.2.11.1)
43
+ activesupport (= 4.2.11.1)
44
+ globalid (>= 0.3.0)
45
+ activemodel (4.2.11.1)
46
+ activesupport (= 4.2.11.1)
34
47
  builder (~> 3.1)
35
- erubi (~> 1.4)
36
- rails-dom-testing (~> 2.0)
37
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
38
- activejob (6.1.7.6)
39
- activesupport (= 6.1.7.6)
40
- globalid (>= 0.3.6)
41
- activesupport (6.1.7.6)
42
- concurrent-ruby (~> 1.0, >= 1.0.2)
43
- i18n (>= 1.6, < 2)
44
- minitest (>= 5.1)
45
- tzinfo (~> 2.0)
46
- zeitwerk (~> 2.3)
47
- appraisal (2.5.0)
48
- bundler
49
- rake
50
- thor (>= 0.14.0)
51
- ast (2.4.2)
52
- builder (3.2.4)
53
- byebug (11.1.3)
54
- coderay (1.1.3)
55
- concurrent-ruby (1.2.3)
56
- contextual_logger (1.3.0)
57
- activesupport (< 7.1)
48
+ activerecord (4.2.11.1)
49
+ activemodel (= 4.2.11.1)
50
+ activesupport (= 4.2.11.1)
51
+ arel (~> 6.0)
52
+ activesupport (4.2.11.1)
53
+ i18n (~> 0.7)
54
+ minitest (~> 5.1)
55
+ thread_safe (~> 0.3, >= 0.3.4)
56
+ tzinfo (~> 1.1)
57
+ arel (6.0.4)
58
+ ast (2.4.0)
59
+ builder (3.2.3)
60
+ coderay (1.1.2)
61
+ concurrent-ruby (1.1.5)
62
+ contextual_logger (0.3.1)
63
+ activesupport
58
64
  json
59
- crass (1.0.6)
60
- date (3.3.4)
61
- diff-lcs (1.5.1)
62
- erubi (1.12.0)
63
- escalate (0.3.0)
65
+ crass (1.0.4)
66
+ erubis (2.7.0)
64
67
  eventmachine (1.2.7)
65
- globalid (1.2.1)
66
- activesupport (>= 6.1)
67
- honeybadger (4.12.2)
68
- i18n (1.14.1)
68
+ globalid (0.4.2)
69
+ activesupport (>= 4.2.0)
70
+ hobo_support (2.2.6)
71
+ rails (~> 4.2.6)
72
+ i18n (0.9.5)
69
73
  concurrent-ruby (~> 1.0)
70
- invoca-utils (0.5.1)
71
- activesupport (>= 5.0)
72
- json (2.7.1)
73
- language_server-protocol (3.17.0.3)
74
- loofah (2.22.0)
74
+ invoca-utils (0.0.5)
75
+ jaro_winkler (1.5.3)
76
+ json (2.3.0)
77
+ loofah (2.2.3)
75
78
  crass (~> 1.0.2)
76
- nokogiri (>= 1.12.0)
77
- mail (2.8.1)
79
+ nokogiri (>= 1.5.9)
80
+ mail (2.7.1)
78
81
  mini_mime (>= 0.1.1)
79
- net-imap
80
- net-pop
81
- net-smtp
82
- method_source (1.0.0)
83
- mini_mime (1.1.5)
84
- mini_portile2 (2.8.5)
85
- minitest (5.22.2)
86
- net-imap (0.4.10)
87
- date
88
- net-protocol
89
- net-pop (0.1.2)
90
- net-protocol
91
- net-protocol (0.2.2)
92
- timeout
93
- net-smtp (0.4.0.1)
94
- net-protocol
95
- nokogiri (1.15.5)
96
- mini_portile2 (~> 2.8.2)
97
- racc (~> 1.4)
98
- parallel (1.24.0)
99
- parser (3.3.0.5)
100
- ast (~> 2.4.1)
101
- racc
102
- power_assert (2.0.3)
103
- pry (0.14.2)
104
- coderay (~> 1.1)
105
- method_source (~> 1.0)
106
- pry-byebug (3.10.1)
107
- byebug (~> 11.0)
108
- pry (>= 0.13, < 0.15)
109
- psych (3.3.4)
110
- racc (1.7.3)
111
- rack (2.2.8)
112
- rack-test (2.1.0)
113
- rack (>= 1.3)
114
- rails-dom-testing (2.2.0)
115
- activesupport (>= 5.0.0)
116
- minitest
117
- nokogiri (>= 1.6)
118
- rails-html-sanitizer (1.6.0)
119
- loofah (~> 2.21)
120
- nokogiri (~> 1.14)
121
- rainbow (3.1.1)
122
- rake (13.1.0)
123
- regexp_parser (2.9.0)
124
- rexml (3.2.6)
125
- rspec (3.13.0)
126
- rspec-core (~> 3.13.0)
127
- rspec-expectations (~> 3.13.0)
128
- rspec-mocks (~> 3.13.0)
129
- rspec-core (3.13.0)
130
- rspec-support (~> 3.13.0)
131
- rspec-expectations (3.13.0)
132
- diff-lcs (>= 1.2.0, < 2.0)
133
- rspec-support (~> 3.13.0)
134
- rspec-mocks (3.13.0)
135
- diff-lcs (>= 1.2.0, < 2.0)
136
- rspec-support (~> 3.13.0)
137
- rspec-support (3.13.0)
138
- rspec_junit_formatter (0.6.0)
139
- rspec-core (>= 2, < 4, != 2.12.0)
140
- rubocop (1.60.2)
141
- json (~> 2.3)
142
- language_server-protocol (>= 3.17.0)
82
+ method_source (0.9.2)
83
+ mini_mime (1.0.1)
84
+ mini_portile2 (2.4.0)
85
+ minitest (5.11.3)
86
+ nokogiri (1.10.4)
87
+ mini_portile2 (~> 2.4.0)
88
+ parallel (1.17.0)
89
+ parser (2.6.3.0)
90
+ ast (~> 2.4.0)
91
+ pry (0.12.2)
92
+ coderay (~> 1.1.0)
93
+ method_source (~> 0.9.0)
94
+ rack (1.6.11)
95
+ rack-test (0.6.3)
96
+ rack (>= 1.0)
97
+ rails (4.2.11.1)
98
+ actionmailer (= 4.2.11.1)
99
+ actionpack (= 4.2.11.1)
100
+ actionview (= 4.2.11.1)
101
+ activejob (= 4.2.11.1)
102
+ activemodel (= 4.2.11.1)
103
+ activerecord (= 4.2.11.1)
104
+ activesupport (= 4.2.11.1)
105
+ bundler (>= 1.3.0, < 2.0)
106
+ railties (= 4.2.11.1)
107
+ sprockets-rails
108
+ rails-deprecated_sanitizer (1.0.3)
109
+ activesupport (>= 4.2.0.alpha)
110
+ rails-dom-testing (1.0.9)
111
+ activesupport (>= 4.2.0, < 5.0)
112
+ nokogiri (~> 1.6)
113
+ rails-deprecated_sanitizer (>= 1.0.1)
114
+ rails-html-sanitizer (1.0.4)
115
+ loofah (~> 2.2, >= 2.2.2)
116
+ railties (4.2.11.1)
117
+ actionpack (= 4.2.11.1)
118
+ activesupport (= 4.2.11.1)
119
+ rake (>= 0.8.7)
120
+ thor (>= 0.18.1, < 2.0)
121
+ rainbow (3.0.0)
122
+ rake (12.3.2)
123
+ rr (1.2.1)
124
+ rubocop (0.74.0)
125
+ jaro_winkler (~> 1.5.1)
143
126
  parallel (~> 1.10)
144
- parser (>= 3.3.0.2)
127
+ parser (>= 2.6)
145
128
  rainbow (>= 2.2.2, < 4.0)
146
- regexp_parser (>= 1.8, < 3.0)
147
- rexml (>= 3.2.5, < 4.0)
148
- rubocop-ast (>= 1.30.0, < 2.0)
149
129
  ruby-progressbar (~> 1.7)
150
- unicode-display_width (>= 2.4.0, < 3.0)
151
- rubocop-ast (1.30.0)
152
- parser (>= 3.2.1.0)
153
- ruby-progressbar (1.13.0)
154
- test-unit (3.6.1)
155
- power_assert
156
- thor (1.3.0)
157
- timeout (0.4.1)
158
- tzinfo (2.0.6)
130
+ unicode-display_width (>= 1.4.0, < 1.7)
131
+ ruby-progressbar (1.10.1)
132
+ shoulda (3.6.0)
133
+ shoulda-context (~> 1.0, >= 1.0.1)
134
+ shoulda-matchers (~> 3.0)
135
+ shoulda-context (1.2.2)
136
+ shoulda-matchers (3.1.3)
137
+ activesupport (>= 4.0.0)
138
+ sprockets (3.7.2)
159
139
  concurrent-ruby (~> 1.0)
160
- unicode-display_width (2.5.0)
161
- zeitwerk (2.6.13)
140
+ rack (> 1, < 3)
141
+ sprockets-rails (3.2.1)
142
+ actionpack (>= 4.0)
143
+ activesupport (>= 4.0)
144
+ sprockets (>= 3.0.0)
145
+ thor (1.0.1)
146
+ thread_safe (0.3.6)
147
+ tzinfo (1.2.5)
148
+ thread_safe (~> 0.1)
149
+ unicode-display_width (1.6.0)
162
150
 
163
151
  PLATFORMS
164
152
  ruby
165
153
 
166
154
  DEPENDENCIES
167
- actionmailer (~> 6.0)
168
- actionpack (~> 6.0)
169
- activesupport (~> 6.0)
170
- appraisal (~> 2.2)
155
+ actionmailer (>= 4.2.11.1)
156
+ actionpack (>= 4.2.11.1)
157
+ activesupport (>= 4.2.11.1)
171
158
  exception_handling!
172
- honeybadger (~> 4.11)
159
+ honeybadger (= 3.3.1.pre.1)!
173
160
  pry
174
- pry-byebug
175
- rake
176
- rspec
177
- rspec_junit_formatter
161
+ rake (>= 0.9)
162
+ rr
178
163
  rubocop
179
- test-unit
164
+ shoulda (> 3.1.1)
180
165
 
181
166
  BUNDLED WITH
182
- 2.3.22
167
+ 1.17.2
data/README.md CHANGED
@@ -2,10 +2,6 @@
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
-
9
5
  ## Installation
10
6
 
11
7
  Add this line to your application's Gemfile:
@@ -25,27 +21,24 @@ Or install it yourself as:
25
21
  Add some code to initialize the settings in your application.
26
22
  For example:
27
23
 
28
- ```ruby
29
- require "exception_handling"
30
-
31
- # required
32
- ExceptionHandling.server_name = Cluster['server_name']
33
- ExceptionHandling.sender_address = %("Exceptions" <exceptions@example.com>)
34
- ExceptionHandling.exception_recipients = ['exceptions@example.com']
35
- ExceptionHandling.logger = Rails.logger
36
-
37
- # optional
38
- ExceptionHandling.escalation_recipients = ['escalation@example.com']
39
- ExceptionHandling.filter_list_filename = "#{Rails.root}/config/exception_filters.yml"
40
- ExceptionHandling.email_environment = Rails.env
41
- ExceptionHandling.eventmachine_safe = false
42
- ExceptionHandling.eventmachine_synchrony = false
43
- ExceptionHandling.sensu_host = "127.0.0.1"
44
- ExceptionHandling.sensu_port = 3030
45
- ExceptionHandling.sensu_prefix = ""
46
- ExceptionHandling.honeybadger_auto_tagger = ->(exception) { [] } # See "Automatically Tagging Exceptions" section below for examples
47
- ExceptionHandling.add_honeybadger_tag_from_log_context("tag-name", path: ["path", "in", "log", "context"])
48
- ```
24
+ require "exception_handling"
25
+
26
+ # required
27
+ ExceptionHandling.server_name = Cluster['server_name']
28
+ ExceptionHandling.sender_address = %("Exceptions" <exceptions@example.com>)
29
+ ExceptionHandling.exception_recipients = ['exceptions@example.com']
30
+ ExceptionHandling.logger = Rails.logger
31
+
32
+ # optional
33
+ ExceptionHandling.escalation_recipients = ['escalation@example.com']
34
+ ExceptionHandling.filter_list_filename = "#{Rails.root}/config/exception_filters.yml"
35
+ ExceptionHandling.email_environment = Rails.env
36
+ ExceptionHandling.eventmachine_safe = false
37
+ ExceptionHandling.eventmachine_synchrony = false
38
+ ExceptionHandling.sensu_host = "127.0.0.1"
39
+ ExceptionHandling.sensu_port = 3030
40
+ ExceptionHandling.sensu_prefix = ""
41
+
49
42
 
50
43
  ## Usage
51
44
 
@@ -65,68 +58,6 @@ Then call any method available in the `ExceptionHandling::Methods` mixin:
65
58
  flash.now['error'] = "A specific error occurred. Support has been notified."
66
59
  end
67
60
 
68
- ### Tagging Exceptions in Honeybadger
69
-
70
- ⚠️ Honeybadger differentiates tags by spaces and/or commas, so you should **not** include spaces or commas in your tags.
71
-
72
- ⚠️ Tags are case-sensitive.
73
-
74
- #### Manually Tagging Exceptions
75
-
76
- Add `:honeybadger_tags` to your `log_context` usage with an array of strings.
77
-
78
- ```ruby
79
- log_error(ex, "A specific error occurred.", honeybadger_tags: ["critical", "sequoia"])
80
- ```
81
-
82
- **Note**: Manual tags will be merged with any automatic tags.
83
-
84
- #### Automatically Tagging Exceptions via Proc (`honeybadger_auto_tagger=`)
85
-
86
- Configure exception handling so that you can automatically apply multiple tags to exceptions sent to honeybadger.
87
-
88
- The Proc must accept an `exception` argument that will be the exception in question and must always return an array of strings (the array can be empty).
89
-
90
- Example to enable auto-tagging:
91
- ```ruby
92
- ExceptionHandling.honeybadger_auto_tagger = ->(exception) do
93
- exception.message.match?(/fire/) ? ["high-urgency", "danger"] : ["low-urgency"]
94
- end
95
- ```
96
-
97
- Example to disable auto-tagging:
98
- ```ruby
99
- ExceptionHandling.honeybadger_auto_tagger = nil
100
- ```
101
-
102
- #### Automatically Tagging Exceptions from Log Context (`add_honeybadger_tag_from_log_context`)
103
-
104
- Add a tag to exceptions sent to honeybadger based on a value in the log context.
105
-
106
- To configure this, use the `add_honeybadger_tag_from_log_context` method.
107
- ```ruby
108
- ExceptionHandling.add_honeybadger_tag_from_log_context("kubernetes_context", path: ["kubernetes", "context"])
109
- ```
110
-
111
- This will add a tag to the exception if the log context contains a value at the specified path: "kubernetes" => { "context" => "value" }.
112
-
113
- For example:
114
- ```ruby
115
- ExceptionHandling.logger.with_context("kubernetes" => { "context" => "local" }) do
116
- log_error(ex, "A specific error occurred.")
117
- end
118
- ```
119
-
120
- This will add the following tag to the exception sent to honeybadger:
121
- ```
122
- kubernetes_context:local
123
- ```
124
-
125
- To clear all automated tagging from the log context, use the `clear_honeybadger_tags_from_log_context` method.
126
- ```ruby
127
- ExceptionHandling.clear_honeybadger_tags_from_log_context
128
- ```
129
-
130
61
  ## Custom Hooks
131
62
 
132
63
  ### custom_data_hook
@@ -158,15 +89,15 @@ There is another hook available intended for custom actions after an error email
158
89
  else
159
90
  Invoca::Metrics::Client.metrics.counter("exception_handling/exception")
160
91
  end
161
-
92
+
162
93
  case honeybadger_status
163
94
  when :success
164
95
  Invoca::Metrics::Client.metrics.counter("exception_handling.honeybadger.success")
165
- when :failure
96
+ when :failure
166
97
  Invoca::Metrics::Client.metrics.counter("exception_handling.honeybadger.failure")
167
98
  when :skipped
168
99
  Invoca::Metrics::Client.metrics.counter("exception_handling.honeybadger.skipped")
169
- end
100
+ end
170
101
  end
171
102
  ExceptionHandling.post_log_error_hook = method(:log_error_metrics)
172
103
 
data/Rakefile CHANGED
@@ -1,15 +1,18 @@
1
1
  #!/usr/bin/env rake
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'rake/testtask'
5
4
  require "bundler/gem_tasks"
5
+ require 'rake/testtask'
6
6
 
7
- require_relative 'spec/rake_test_warning_false'
8
-
9
- desc "run rspec unit tests"
10
- begin
11
- require 'rspec/core/rake_task'
12
- RSpec::Core::RakeTask.new(:rspec)
7
+ namespace :test do
8
+ Rake::TestTask.new do |t|
9
+ t.name = :unit
10
+ t.libs << "test"
11
+ t.pattern = 'test/unit/**/*_test.rb'
12
+ t.verbose = true
13
+ end
14
+ Rake::Task['test:unit'].comment = "Run the unit tests"
13
15
  end
14
16
 
15
- task default: :rspec
17
+ task test: 'test:unit'
18
+ task default: 'test'
@@ -3,13 +3,13 @@
3
3
  require File.expand_path('lib/exception_handling/version', __dir__)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.authors = ["Invoca"]
7
- spec.email = ["development@invoca.com"]
6
+ spec.authors = ["Colin Kelley"]
7
+ spec.email = ["colindkelley@gmail.com"]
8
8
  spec.description = 'Exception handling logger/emailer'
9
9
  spec.summary = "Invoca's exception handling logger/emailer layer, based on exception_notifier. Works with Rails or EventMachine or EventMachine+Synchrony."
10
10
  spec.homepage = "https://github.com/Invoca/exception_handling"
11
11
 
12
- spec.files = `git ls-files`.split("\n")
12
+ spec.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
13
13
  spec.executables = spec.files.grep(%r{^bin/}).map { |f| File.basename(f) }
14
14
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/.*\.rb})
15
15
  spec.name = "exception_handling"
@@ -20,15 +20,11 @@ Gem::Specification.new do |spec|
20
20
  "allowed_push_host" => "https://rubygems.org"
21
21
  }
22
22
 
23
- spec.required_ruby_version = '>= 2.7.0'
24
-
25
- spec.add_dependency 'actionmailer', '>= 5.2'
26
- spec.add_dependency 'actionpack', '>= 5.2'
27
- spec.add_dependency 'activesupport', '>= 5.2'
28
- spec.add_dependency 'contextual_logger', '~> 1.0'
29
- spec.add_dependency 'escalate', '~> 0.3'
30
- spec.add_dependency 'eventmachine', '~> 1.0'
31
- spec.add_dependency 'invoca-utils', '~> 0.3'
32
- spec.add_dependency 'psych', '~> 3.0'
33
- spec.add_dependency 'net-smtp'
23
+ spec.add_dependency 'actionmailer', '~> 4.2'
24
+ spec.add_dependency 'actionpack', '~> 4.2'
25
+ spec.add_dependency 'activesupport', '~> 4.2'
26
+ spec.add_dependency 'contextual_logger'
27
+ spec.add_dependency 'eventmachine', '~> 1.0'
28
+ spec.add_dependency 'hobo_support'
29
+ spec.add_dependency 'invoca-utils', '~> 0.0'
34
30
  end